Wednesday, June 10, 2020

Module 4: Geoprocessing




     This week's lab introduced us to how python can be used for geoprocessing purposes. We were required to create a model in ArcGIS Pro's model builder that utilized the Clip, Select by Attribute, and Erase geoprocessing tools. We were also tasked with writing code that added XY coordinates to a shapefile, created a buffer around the features of that shapefile, dissolved the buffer into its own feature layer, and returned messages after each of these actions. The results of this code are depicted in the above (top) screenshot.
     I began by writing the code to import the arcpy and env modules. I then wrote the code for setting the workspace and adding the XY coordinates. I manually wrote the code for printing the task being conducted and utilized the GetMessages function for the rest of the messages printed. At this point, I realized I had not included a means for overwriting outputs and went back to insert code for this after the workspace setting. The code for creating the buffer came next, along with the manual code for printing the task and the GetMessages function for the rest of the printed messages. I included \n in the print code to make the printed messages easier to read. Finally, I wrote the code for dissolving the buffer into its own layer and for printing the messages. The code for these messages was written in the same manner as the previous messages, also with the inclusion of the \n. All code in the script used the syntax for a stand-alone script. The flowchart for this script is depicted in the above (bottom) screenshot.

No comments:

Post a Comment