Wednesday, June 24, 2015

Module 6 - Geoprocessing with Python

In this lab, we were to write a script that performs some geoprocessing functions. For me, being able to use the Search tool to look up the proper syntax for a geoprocessing function was very useful. In this script, I imported the relevant modules and set the workspace. This script first adds XY coordinates to the "hospitals" shapefile using the AddXY tool. It then uses the Buffer tool to create a 1000 meter buffer around the hospital features. After the buffer is created, it uses the Dissolve tool to dissolve the hospital buffers into a single feature. After each geoprocessing function was completed, I used the GetMessages() function to print out the messages from that tool. After that I went back through and commented the script to show which geoprocessing tool was being run. I also went back to the top of the script and used comments to add my name, date, the script's name, and a description of what the script does. Below is a screenshot of the results from the interactive window (created from the GetMessages() function).


This lab, while relatively short, was a good instruction of how to use Python to perform various geoprocessing tools, and learning that the Desktop Help and the Search button in ArcMap will show us the syntax is very helpful, and will be useful in future labs.

No comments:

Post a Comment