Wednesday, June 27, 2018

GIS Programming Module 6

The process for writing the script was fairly simple for this lab with the help of the syntax helper tools. First I created the comments for the script with correct naming conventions and dates. Second I started with importing arcpy and environment modules and setting the workspace to my folder as well as allowing overwriting in the environment. Now it was time to start running the tools. First the AddXY tool gave me issues due to the fact that the tool alters the original shapefile by adding the XY data directly to those attributes. To fix this following the syntax helper I added a line of code to create a copy of the shapefile prior to adding the data. This allowed me to keep the original in my data folder. Next I added the code to create the correct 1000 meter buffer around the locations. This tool was fairly easy to code and ran perfectly the first time. Finally the dissolve tool gave me issues due to the fact that it was a management tool rather than an analysis tool. Since I had not used the tool many times in the application I incorrectly had it coded as an analysis tool (arcpy.Dissolve_analysis). As you can imagine the error code that was generated threw me for a loop. After a while of troubleshooting I realized the simple mistake and fixed the code allowing it to run properly.  To finish the code I added the print statements after all of the tools to print the correct data for the deliverable.

No comments:

Post a Comment