Wednesday, May 28, 2014

GIS 5103 Module 2: Geoprocessing in ArcGIS



This week continued our introduction to Python programming.  Unlike last week, however, this time we used Python script to utilize ArcGIS tools to produce output data.  The first step was to create a model using ModelBuilder to produce the layer pictured above.  This model needed to clip a layer representing a large area of soils to a small layer representing a basin, then to select from the soil layer all areas classified as "not prime farmland," and finally to remove from the basin layer areas that coincided with this soil selection.  The model was then exported as a Python script for further exploration and editing.

It was at this point that I experienced an issue.  Prior to exporting the model as a Python script, we were required to set our model variables as model parameters.  Because my model had five variables, the instructions' reference to four variables led me to not set the final variable as a model parameter.  I proceeded with the assignment, following the instructions to make the script operational outside of ArcMap by entering the file paths for the soils and basin layers and including the line of code to allow data overwriting.  However, I kept getting a "Parameters are not valid" error when I ran the script.  I eventually stumbled upon my simple mistake of not setting my final variable as a model parameter; the script ran smoothly afterward.

I enjoyed this introduction to using Python script for geoprocessing.  Even my little error described above taught me how important it is to pay attention to detail when programming.  I am looking forward to learning more in the next module.

No comments:

Post a Comment