Python Scripting: Let the Snake take a bite out of Time Slithery-Smooth GIS Process Automation
Martin County Property Appraiser’s Office John Watterson – GIS Specialist What is Python?
• Free open source programming language used in numerous fields, not just GIS
• Non-profit foundation: www.python.org
• Embraced by ESRI for the long haul History of Python at the PAO
• Since 2008
• Easy to learn
• Clear and logical syntax Basic benefits of using Python in ArcGIS
• Saves work time; and therefore money
• Perfect for automating redundant geoprocessing
• No programming experience required
Basic benefits of using Python in ArcGIS continued
• Elimination of human error
• Versatility: Can run in ArcToolbox
• Increased productivity; Scheduled tasks Return on Investment
• Can be huge
• Martin County Property Appraiser’s Office uses 12 Python Scripts
What the experts are saying
• Adena Schutzberg of Directions Magazine: Scripting = understanding building blocks of GIS
• Jack Dangermond: Python, Python, Python
• Python scripting – A sought-after skill in the GIS job marketplace
• “Yes, You Need to Code” blog article Starting point for writing scripts
• ArcGIS Desktop Help – A valuable resource
• Locate favorite tools in ArcToolbox and right click
PDF tax maps to web script Standard lines of Python code Script finished successfully message PDF tax maps to web script
Do the math!
2 hours manually x 12 months =
24 hours saved or 3 working days per year! Value Annotation Script Value Annotation Script
Do the math!
2 hours manually x 2 times a week x 5.5 month valuation period (22 weeks) =
88 hours saved or 11 working days per year! Neighborhood script Neighborhood script
Do the math!
30 minutes manually x 2 times a year = 1 hour a year CAMA shapefile to web script CAMA shapefile to web script
Do the math!
45 minutes manually x 12 times a year =
9 hours saved a year or approximately 1 work day per year! Do the Math!!
With all the scripts we run at the PAO, Python has saved me 1 month per year! Python command Line in ArcGIS
• Open right in ArcMap
• Start typing Python commands
• Auto-complete feature
• Walk through help window
Add-ins with Python
• New to ArcGIS 10.1
• Extending the ArcGIS interface
• So what’s next?
Python advantages over ModelBuilder
• Visualization of code
• Model Builder (MB) has no mapping module • Limited in advanced programming methods(MB)
• Suitable for writing complex script workflows • Run outside of ArcGIS
• More Help
Course resources
• Geospatial Training Services: www.geospatialtraining.com
• ESRI: www.esri.com/training/main
GIS Python books
• “Python Scripting for ArcGIS”, Zanderbergen
• “A Python Primer for ArcGIS”, Jennings
• “Programming ArcGIS 10.1 with Python Cookbook”, Pimpler
• “Python Geospatial Development”, Westra
• “GIS Tutorial for Python Scripting”, Allen
Questions or Comments