Friday, June 19, 2015

GISProgramming: Module 5 - Geoprocessing in ArcGIS

     This week I added some new tools to my GIS toolbox -- batch processing (a huge time saver) and geoprocessing with Python script (by way of ModelBuilder). Geoprocessing in ArcGIS is carried out through toolsets found in ArcToolbox, models made in ModelBuilder, or Python scripts. In the Intro to GIS course, I learned how to use many of these tools and I even took a virtual course that introduced ModelBuilder and its capabilities. This semester rounds out the geoprocessing tool kit by introducing geoprocessing using Python. Now, not only can I make a model in ModelBuilder but I can take that model and export it into Python script to make an even more robust geoprocessing environment -- one that is custom made to suit my geoprocessing needs.

ModelBuilder
     ModelBuilder is a visual programming language and this makes programming intuitive and appealing. The ability to drag and drop shapefiles and tools into the interactive window allows the programmer to easily follow the logic of their model. Both shapes and color increase user friendliness and add an additional level of design appeal. That is, as you manipulate the parameters (symbolized by ovals for input/output and rectangles for tools) of the model, the become colored to indicate their state (color being ready to run and hollow demonstrating insufficient input). When the model is run, the tools and outputs display a drop shadow indicating their successful implementation.

Geoprocessing Scripts
     Python scripting, unlike ModelBuilder, is text-based. One of the great features of models made with ModelBuilder is that they can be exported to Python script. With some tinkering (the resulting script is a skeleton and requires additional information, such as full file paths), the script becomes a more robust version of the model (because it does not require ArcMap to be open in order to run). This script can me made into a script tool by importing it into your custom tool box. It is also possible to share these custom tools by way of zip files.

Geoprocessing in ArcGIS
     Below is a screenshot of the output shapefile produced using the geoprocessing methods discussed above. The assignment asked us to make a model that removes soils that are poorly suited to farming from a given geographic extent, in this case a basin. The model (and script) I programmed takes a shapefile of soil types and clips (using the Clip tool) it to the extent of a basin. A selection (Select tool) is made (SQL statement written) to chose soils from this new output that are classified as "not prime farmland." The selected soils are then removed from the basin (Erase tool) with the final output being a shapefile displaying only a subset of the soils from the original shapefile remaining.  

A screenshot of the result of geoprocessing in ArcGIS using a model written in
ModelBuilder (with an accompanying Python script that produces the same result). 



No comments:

Post a Comment