Module 4 - Geoprocessing

Using ModelBuilder in ArcGIS Pro is an excellent tool to streamline repetitive or complex processes. For this module, the goal was to create a model (part A) and a script (part B) from scratch. Models on ArcGIS Pro look very similar to flowcharts and run from the starting input feature, though the tool process, and then produces an output feature that could then be linked to another tool process to create another output feature. The assignment for part A is the following: 

  • Clip all soils to the extent of the basin
  • Select all soils that are classified as "Not prime farmland" under the [FARMLNDCL] attribute
  • Erase the "Not prime farmland" soil selection from the clipped soils basin polygon

The soils data (polygons) was the input feature of the model. These data were clipped using the CLIP geoprocessing tool. An image of the soils data before clipping to the basin footprint is below:

The soils after clipping to the basin and selecting/deleting the soils that are classified as "Not prime farmland" looked like the final image below. The red areas are suitable farmland soils that are located within the basin area: 

The assignment for Part B was to take a set of hospital locations (points) and create a script that completed the following tasks:
  • Add XY Coordinates to the hospitals shapefile
  • Create a 1000 meter buffer around the hospital feature
  • Dissolve the hospital buffers into a separate, single feature
I found that using ModelBuilder to create the process first and then exporting as a python (.py) file was a much easier way to get a script that could be modified later on, rather than write a script completely from scratch. One thing to note that when exporting to a stand-alone script, the import arcpy command is required at the beginning of the script to set the arcpy workspace. Additionally, the GetMessages() function needed to be added to the script after each of the three tasks performed to print the messages from that tool, specifically the start and end times. A printed comment to show the start of the process was also put at the beginning of each process, such as "Adding XY coordinates to the shapefile..." and "Executing buffer analysis on the shapefile." Screenshots of the printed script results and the map results after running the final script is shown below: 

One thing to note is that in order to create an extra line of space between the printed results, the "\n" needed to be placed between the string quotations. Overall, both models and scripts provide a much simpler process than running each tool one at a time. Therefore, I am excited to become even more skilled in these areas to make some GIS analyses much simpler and less time consuming! 

 

Comments