Hello and welcome to the final module for the GIS Programming class. This is the essential culmination of everything that has come before. The creation of a script that is then incorporated into a script tool within a custom tool box, and then given supplemental help information and set up for sharing with other GISers. Being able to build and share your own script tools is in my opinion the greatest and longest lasting purpose of integrating python into arcmap. The process time that can be saved by incorporating Python is amazing. And putting all of these tools together and exercising them was the overall objective of this module. Lets look at the result of this weeks tool. Its a random buffer tool which takes an input polygon and generates points at random throughout based on user inputs, and then adds a buffer based on user defined distance.
Above you can see the Random Buffer Tool dialog box with the user inputs used to generate the random sampling displayed. Additionally you can see the ArcCatalog file structure being employed. Another significant portion of this module was to exercise setting up a standard file structure for ease of reference when sharing tools.
As this is the last module for the class I will also share some of the key things I have learned looking back, not just what has been shared throughout the courses blogs.
1. env.overwriteOutput = True This is one of the most beneficial things that I have used this entire time. The ability to modify your script and re-run and have previous results overwritten is awesome!
2. When in doubt, shutdown Arcmap, ArcCatalog, close your script and refresh everything, then try your script again.
3. Spaces, colons (:), quotes ‘””’ really make a difference.
4. Adding Print messages really is one of the best and quickest trouble shooting methods.
5. Strings, Lists, and Objects, an object can be a list or string, a list can be made a string.
6. Being able to script tools really is the culmination of the course and one of the best uses of Python with ArcMAP
a. I have a “Cursor Position error” when trying to run several standard ArcMap Tools on my personal desktop version of Arcmap, however running the tools/scripts in ArcPy has still been successful. Understanding how to run the tools in Arcpy has been amazing.
7. Arcpy.GetParameter() and arcpy.GetParameterAsText() are two of the most useful ways to correct for hardcoded parameters in a script.
a. Hardcoding should be a last resort for tool building.
Python Scripting is a huge resource for use within ArcGIS applications. Anyone getting into ArcGIS should have some understanding of the benefits of scripting!
How big of a bite does Python take? ... Megabytes!
No comments:
Post a Comment