Hello all, the fourth week of GIS Programming (4102/5103) was an introduction to running geoprocessing tools using ModelBuilder in ArcGIS and a main focus on using Python scripts to run geoprocesses. The first thing to learn about using Python for GIS is to import arcpy and set your workspace to begin the code. Some main things to watch out for when using GIS tools in Python are things such as allowing outputs to be overwritten, using the correct syntax for the tools, making sure data exists, and assigning features to variables in the script. These can allow for the scripts to run smoother and without errors.
The first part of this assignment included using the Clip, Select, and Erase tools in ArcGIS using a ModelBuilder. The logic of the model was relatively simple and could erase the selected soil areas that were not prime for farming.

The second part of the assignment asked for the use of the AddXY, Buffer, and Dissolve tools on a shapefile of hospitals. The first step of this code was to import arcpy and set the correct workspace. I decided to turn the shapefiles I would be using into variables, both to cut down the length of the code and to make it easily changeable. I also made sure to allow the overwriting of existing files. After all that I ran the AddXY tool, which added XY coordinates to the hospitals shapefile. This allowed me to run the Buffer tool, creating a 1000-meter buffer around each hospital point in the data. The last tool was the dissolve tool which dissolved the circles to give a more smooth look to the final product. The last step was to use the getmessages tool in order to print out the message that ArcGIS produces when running the tool. I also decided to print out a brief description of the function of each tool before running them, as can be seen in the output below. I had to do this because ArcGIS only prints out the start and success time when using the getmessages tool. 

Comments
Post a Comment