Intro to Model Builder and Automation
This week's lab involved me automating a standard geoprocessing analysis. The exercise involved using Model Builder (which I had never used before) to clip selected features from intermittent data within an area all at the same time. I've done this type of analysis numerous times, but never this quick. By setting up the parameters all in Model Builder rather than perform each geoprocessing task individually, I felt this was a more efficient process to derive the final dataset.
In this example, the soil layer is being clipped by the extent of the basin layer. Unsuitable areas are selected and then deleted, leaving only the suitable areas as a newly created shapefile. Using Model Builder shaved minutes off of the time to complete this example, saving me from doing the analysis in the map view and using the query builder.
The lab of this week's module involved building a script that would designate a spatial reference of a shapefile, append XY coordinates to a copied shapefile, buffer a layer of point features, and finally dissolve the created polygons into a single polygon. I can confidently say this script did not give me much trouble. I think it was perhaps because I set the spatial reference properly the first time I tried. In order to add XY coordinates, a coordinate system needs to be defined. I assigned the layer's projection file as the coordinate system and also defined it as the output coordinate system. This is important because in order to add XY coordinates to a shapefile, a copy of the shapefile needs to be created and the spatial reference of both files needs to be the same.
After setting the workspace environment and spatial reference, it was only a matter of creating print statements around the three different geoprocessing tasks in the code. The first print statement before a task is announces what task is being performed. The print statement after the task is performed prints the messages of the task (time stamps of successful execution). The syntax of the tasks themselves were very easy to follow from the ArcGIS Pro links.
Comments
Post a Comment