Sunday, June 15, 2014

GIS 4102 GIS Programming Module 5: Geoprocessing with Python

This week's module included using tools after setting the workspace. This specific script used the AddXY tool, the Buffer tool, and the Dissolve tool to add XY coordinates to a hospitals layer, add a buffer of 1000 meters around each hospital, and finally dissolve the buffers into a separate, single feature. Prior to using these tools, a copy of the original layer was created in order to retain that information unchanged. Since variables are very helpful in creating code that is reusable and can be shared, I took this opportunity to practice assigning variables to input and output features. There was also an opportunity to apply Comment Out Region to a section of code while making adjustments to the code. The script included code to print out the tool messages directly after each tool was run. These are shown in the image below.

PythonWin is my preferred place for scripting. Throughout the scripting process I double-checked that results were added to ArcCatalog. After the script was completed, it was run in ArcMap; the code running through its cycle and adding the results of each step to a map was quite amazing to watch. With each Python exercise and assignment, terms and coding are becoming more familiar making scripting easier overall.
Tool Messages Printed after Each Tool Ran

No comments:

Post a Comment