Using Chat GPT and Python for GIS? Lets GO!!!! | Excel, Python, ArcGIS Pro, & Chat GPT (Pt. 3)

preview_player
Показать описание
This video details using Chat GPT, ArcGIS Pro, and Python to boost productivity within ArcGIS Pro. Specifically we will be subsetting a large data set and getting the SQL query data for that large query. Trying to do this by hand could be tedious but with a few lines of python you can get it done quick. Stay tuned for more ways to use Chat GPT for GIS.
Thanks for watching! Please like, subscribe, and comment below with any questions.
Table of Contents

00:00 – Intro
01:12 – Asking Chat GPT about a python script
01:47 – Copying code from Chat GPT
02:02 – Opening Python Notebook in ArcGIS Pro and pasting code in
02:15 – Break Down of GPT code line by line and creating query
04:22 – Printing the Query data to use in Definition Query and Select By Attributes
04:53 – Creating Definition query from query we just created
05:16 – Removing Definition Query
05:25 – Selecting by attributes with the query we just created
06:01 – Outro

Code:
import arcpy

# Set the workspace and table
table = "'YourTable'"

# Get unique IDs

# Construct the query
query = " OR ".join(f'YourField = {id}' for id in unique_ids)

# Apply the query
print(query)
Рекомендации по теме
Комментарии
Автор

In order to do something similar without python (code used in video description) especially if you did not need the query data you could:
- Do an attribute join of the id field to the larger feature class
Result: a feature class where only the values with an Id in the subset have a value in the joined table ID field.
- Select by attributes – Select where join table ID field is “not null”
Result: This will select only the features that matched the joined excel table
- Export the selected features- right click on the feature class - go to data - export features

GeoFolks
welcome to shbcf.ru