Monday, June 10, 2024

M4 - Geoprocessing

 Greetings,

Welcome back to more adventures in scripting. This weeks emphasis is on working with Geoprocessing tools in multiple ways. Specifically, we can work with them one tool and one item at a time. Or through batch processing of a tool, or a model of multiple tools. The two primary things that were explored were the creation of a Model in ArcPro's Model Builder, and the creation of a standalone python script from scratch to execute three separate tools. The processes were as follows:

For the Model Builder: 

Take two input variables and clip one to the other. With the clip output, select particular features from the resulting data table. Then with those features selected, erase them from the previous output. The final shapefile then has removed undesireable areas from the original clip data. This leaves a shapefile filled with suitable space for other subsequent processing. 

For the Standalone Script:

There are three processes being performed. First, a provided shapefile is gaining XY coordinate data, then that output shapefile with said data gets a buffer applied. From the buffered shapefile we now dissolve the overlapping lines and create a separate standalone file from the buffered features. 

The output of which is below:


Note: I have tailored the script to include process indicators. They are a combination of print objects which highlight which process is being ran of the three, and ArcMessages which show the start and success times. Then finally, the process highlights completion. 

The script accomplishing this is the first full from scratch script that I have worked through. But don't let this idea fool you. There is a good deal of copying successful components from other scripts into this one. There was copious amounts of trial and error associated with using ArcPro Notebooks to test each segment of the script. While the script does have numerous comments to denote overall task flow it is missing some features from previous scripts. I have not incorporated some of the debugging features from the previous module. If I was worried about certain processes failing, instead of testing the script to near guaranteed success, I could have incorporated some try, except statements. 

The most serious impediment that I came across while testing involved having the Hospitals shapefile open in multiple places at once, preventing processing. For example, it cant be open in a ArcPro Map, and being modified by a standalone script in IDLE. Otherwise, it works fine, and this was a good learning point.

Thank you.

v/r
Brandon


No comments:

Post a Comment

Special Topics - Mod 3 - Lab 6 - Aggregation and Scale

 Hello and Welcome back!  My how time has flown. It has almost been 8 weeks, and 6 different labs. There have been so many topics covered in...