Tuesday, June 10, 2025

M4 - GIS Programming - Geoprocessing

 

The above image displays screenshots of the results from a geoprocessing script executed in IDLE. The map screenshots display the different output layers created by the script, including XY coordinates added to the "hospitals" shapefile, a 1000-meter buffer around each hospital location, and the 1000-meter buffer being dissolved into a single feature.

Week 4 allowed us to dig in and get our hands dirty with ArcGIS Pro ModelBuilder, a visual programming interface that enables users to create, manage, and automate geoprocessing workflows. In addition to exploring ModelBuilder, we also began working with writing and executing geoprocessing scripts in Python.

This week, we learned more about setting up our workspace within our Python script and automating the execution of ArcGIS Pro geoprocessing tools using scripting.

The above image shows screenshots of my IDLE Python prompt window after executing a script I wrote that adds XY coordinates to, buffers, and dissolves a hospital shapefile within our ArcGIS Pro project.

To create my full script, I started by setting up my workspace. While it wasn’t strictly necessary to include workspace setup steps within my Notebook (since I was working with an open project in ArcGIS Pro), I added these steps in case I may want to use the script as a standalone in the future. I also set the script’s ability to overwrite files to True.

Once my workspace was set, I opened each individual tool within the geoprocessing pane and configured all the parameters using the tool’s graphical user interface (GUI). After setting all the parameters, I clicked the drop-down menu attached to the “Run” button and selected "Copy Python Command." I then pasted the copied command into a new cell in my ArcGIS Pro Notebook. I added “processing” messages directly before each step so users would know where the program is in its process, as well as the resulting tool messages following each step.

At the end of my script, I included a “Processing complete” message to indicate that the script had run and completed its steps successfully.

This was a valuable learning experience, and I thoroughly enjoyed returning to working directly with ArcGIS Pro.

No comments:

Post a Comment

M5 - GIS Programming - Explore and Manipulate Data using Python

This week allowed us to dive deeper into ArcPy and explore data manipulation within ArcGIS Pro. We focused on using Python scripts to intera...