Friday, June 20, 2014

Module 5: Geoprocessing Using Python

This weeks assignment was to become familiar with geoprocessing in Python.  This was primarily accomplished by writing scripts that performed sequential geoprocessing tools in the arcpy site package.  The following is a breif transcript of my notes to complete the assignment.
1. First, I looked in the help window for a description on the Add XY tool as well as the Dissolve tool, just to get an idea of how they worked and what they did.
2. Next, I opened the ArcMap Interactive Python window as well as the PythonWin program.  I first used the scripts in ArcMap so that I could visually see what was happening to the data, then copied the text to a new script file in PythonWin.
3. Because the script should be standalone (outside of Arcmap), it first required to import the arcpy site package.  Then, I imported environment class and set the overwrite option to ‘true’.
4. Then I used the three tools in sequence: Add XY, buffer, and dissolve.  I followed the syntax described in the help folder as well as the easy to follow interactive python help window in ArcMap.
5. After each tool I added the GetMessage function.  Further I used the  ‘+ “\n”’ after the first two tools so that the message was easier to read.
6. I tested the tool in PythonWin and ArcMap to see if the desired result occurred; it did.

No comments:

Post a Comment