Friday, July 29, 2016

Module 11 - Sharing Tools

Our module this week took sharing scripts to the next level.  We learned to take an existing script, place it in a toolbox.  Once it was in our toolbox, we could now add various parameters using sys.argv[ ] avoiding hard coding paths.  While providing comments in a script is very useful, for someone unfamiliar with python, reading the script would be difficult.  The script tool uses a gui interface; this gui, is not automatically populated with descriptions about the various parameter.  Last week we learned where to place the description of the tool in the tool properties.  This week we learned how to use the Item Description tab in AcrCatalog to edit the syntax section for each of the parameters.  Adding information here provides built in help/guidance for the end user so that they know what type of information is expected for each parameter.  This allows them to execute the tool without a working knowledge of scripting.  Another advantage to using a script tool is that it can be embedded into the toolbox.  This allows for simpler sharing since only the toolbox would need to be shared, not the underlying script related to the tool.  In addition, once the script is embedded a password may be assigned.  The tool functionality is not affected by the password, but the ability to view and export the actual script is prohibited unless you know the password.   This prevents script piracy and ensures your hard work remains your hard work and others cannot take credit or modify its contents. The combined screenshots below illustrate the gui interface for the script tool and the results of utilizing said tool within ArcMap.




As this is our final blog post for the semester, we were asked to summarize the most memorable, interesting or useful things learned about Python with ArcGIS.  Honestly, the most memorable/useful thing from this course has been overcoming my fear of scripting.  After the first couple of assignments, I no longer dreaded the thought of tackling the next one.  This was huge for me and will greatly help not only future GIS work but also work involving other programming languages as I will not have the mental block I once had.  From the course overview perspective, I think the raster module will prove particularly useful and time saving in the future.  Additionally, the ability to setup scripts for repetitive tasks and be able to set them to use workspace parameters rather than hard coded locations is huge.  Combine that with the ability to share these time saving tasks with coworkers and you look like the department rock star.

No comments:

Post a Comment