Friday, May 30, 2014

GIS Programming Module 2 - Geoprocessing in ArcGIS

Polygon of suitable farmlands, created in ModelBuilder
In this assignment for GIS Programming, we created a model in ArcGIS ModelBuilder.  Data for soils, as well as the attributes for the small basin outside Hawley, MN, were the original output data.  A model was then created which can automate the employment of tools which will first select the soil parcels in the study area which are not prime farmland, then create a new layer from which those parcels have been excluded.  That layer is then clipped to the extent of the basin.  The result is the pink polygon in the map to the left.  This is the area of all lands in that small basin that are currently or potentially suitable for farming.

After the model was created in ModelBuilder, it was exported as a Python script and modified (by addition of full file paths to input data).  The resulting script can be run in PythonWin, outside the ArcGIS environment, create the output layers, and store them in the appropriate Results folder, to be added to an ArcMap .mxd file at any time.


The steps involved in creating the output dataset of suitable farmlands in the basin are listed below:

1. First, define the task to be performed:  Select the areas within the basin that have soils that area suitable         for farming.
2. Procedure: Select the polygons from the Soils shapefile that are classified as “not prime farmland” and           erase that selection from the Soils shapefile.  Then, clip the resulting layer to the extent of the basin.
3. Add the Basin and Soils layers from the Data folder to the blank .mxd.
4. After creating a toolbox in the Module 2 folder, Rt.Click > New > Model.
5. In the ModelBuilder window:  Model > Model Properties: Name and label the model, and provide a             description of what it does: SoilErase, Soil Erase, and that it will remove the polygons from the Soils             shapefile that are not prime farmland, and clip them to the basin layer extent.
6. Drag the Basin and Soils features from the Table of Contents into the Model Builder window
7. Open the Arc Toolbox window.   Navigate to the Select tool (Analysis > Extract) and drag it into the           modelbuilder window.  Then, double click on the Select box.
8. Fill in the parameters for the select tool:  Input: soils.  Output: will be called soils_Select.shp.
9. The SQL expression for the selection is “FARMLNDCL” = ‘not prime farmland’   Click Okay.
10. The output element will appear with the output file name.
11. Drag the Erase tool (Analysis > Overlay) into the ModelBuilder window and double-click it.
12. Input: soils.  Erase feature: soils_Select.shp.  Output feature: soils_Erase.shp.  Click Okay.
13. Drag the clip tool into the ModelBuilder window.  Double click it.
14. Input: soils_Erase.shp. Clip feature: basin.  Output: soils_Erase_Clip.shp.  This is the final output.  All             elements are now in color which means they are ready; none are white.  They contain the data and                 filepaths that they need.  Original input data is blue, output is green, and tools are yellow.
15. Rt.Click on each of the input and output elements, including the final output, and click Model Parameter         for each one.  There are five in all (does not include tools).
16. Save the model at the top menu of the ModelBuilder window.
17. To run the model, click on the small blue triangle arrow on the right end of the main menu bar of the               ModelBuilder window.  The tool and output elements will have a gray drop-shadow once they have run         successfully (the original input data elements will not).
18.  After creating the model and script, I discovered how to use the Dissolve tool to aggregate the polygons        within the Soils_Erase_Clip (Data Management Tools > Generalization > Dissolve).  This tool was not          included in the model or the script however.


Model to create a suitable soils layer, using ArcGIS ModelBuilder

No comments:

Post a Comment