Saturday, July 30, 2016

GIS5103 - Module 11 - Sharing Tools

In Module 11, our final module for GIS Programming, we were tasked with editing a provided toolbox, script tool, and script.  The purpose of the script tool was to create randomly placed points inside/along a boundary feature and then create a buffer feature around those points.  Parameters for the tool were read in the script using sys.argv[] .   This function is similar to the arcpy.GetParameter() and GetParameterAsText() functions but has a character limit.  The provided script had the input boundary file and output file paths hardcoded in the script.   We had to edit the script to accept a parameter using the sys.argv[] code.  After making the script modifications, the tool ran successfully.
Module 11 Random Buffer Tool Dialog Window
Next we had to edit the Item Description for the tool.  This enables the script author to provide an explanation and description of the tool, its purpose, limitations, and parameter explanations.   Providing this information to the end user makes the tool more user friendly.  Prior to sharing our tool we embedded the script.   This allows us to only have to share the toolbox file and eliminates the need to compress the toolbox file with the script file.  Once the script has been imported by the tool, it is also possible to password protect the tool.   Password protection prevents others from copying or editing your tool without your permission.  After running the tool again, I created the following map displaying the boundary feature (NuevoLeon.shp) and the two output features created by the tool (random points and buffer around random points).
Module 11 Random Buffer Tool Output Features with Boundary Feature

This module was valuable in showing the importance of using a standard format for file organization as well as the importance of relative paths.  Providing documentation to the script tool user is a vital part of the tool creation.

Difficult to believe this is our last module assignment.   I did not know what to expect about Python programming, but have enjoyed this class.   It had been over 20 years since I had taken a programming class and over a decade since I had edited or worked directly with code.   I enjoyed using Python.  Object oriented languages appeal to my way of learning.   As I continue my journey towards GIS certification, I can see how a solid knowledge of Python can enhance a GIS project.   Whether scripting is used to automate geoprocessing tasks or to generate tools to be shared by others, I realize what a powerful component Python is to GIS analysis.


No comments:

Post a Comment