This weeks lab focused on creating scripts for Geoprocessing in ArcGIS Pro. First, I created and ran a script in ModelBuilder that used Clips, Select, and Erase Tools. The real challenge of this lab was writing my own geoprocessing script in Notebook in ArcGIS Pro. For each script, we were instructed to use the GetMessages() function to print the messages from the tool. Below are the results of the scripts that I wrote.
 |
| For the first script, I used the arcpy.management.AddXY() function to add XY coordinates to one of the shapefiles in this week's data folder. I opened the shapefile in ArcGIS Pro and looked at the attribute table to see that coordinate fields were added. |
 |
| This was the most challenging script for me because of the all the parameters that needed to be defined to run the buffer function. The function I used for this script was arcpy.analysis.Buffer(). After trying to run the script unsuccessfully a couple of time, I added a try-except statement and printed out the errors. Then, I looked through the textbook and found that I was missing some of the parameters needed for the function. Once everything was listed in the within the function, the script ran successfully. |
 |
I used the arcpy.management.Dissolve() function for this script to make the original hospitals shapefile and the buffer I created in the previous script into a single feature. This script had less parameters to define so it was easier for me to complete without errors!
It was fun to re-explore the geoprocessing tools that I learned in Intro to GIS this week. I look forward to having more practice writing my own scripts. |
Comments
Post a Comment