Automate ArcGIS with Python to Streamline Geographic Data Analysis Ryan Lambert Database Developer / Analyst, Front Range Community College, CO Ryan.Lambert@frontrange.edu AIR Forum 2017 – Washington D.C. Been at FRCC for 6 years, in IR for over 9 total. 3rd time at AIR, 2nd time as a presenter.
Automate ArcGIS with Python to Streamline Geographic Data Analysis © Ryan Lambert, Front Range Community College, 2017
This Presentation… Demonstrates How to Use MapBuilder Highlights How Automation can Increase Productivity Is an Invitation to Collaborate on MapBuilder 2 Collaborate: Need two types of users – People to USE the program to make BEAUTIFUL maps People to DEVELOP the program Automate ArcGIS with Python to Streamline Geographic Data Analysis © Ryan Lambert, Front Range Community College, 2017
Automate ArcGIS with Python to Streamline Geographic Data Analysis © Ryan Lambert, Front Range Community College, 2017
What Is MapBuilder? Wraps around ArcPy module to Streamline and Simplify Open Source Python Project Licensed under MIT License GitHub: https://github.com/rustprooflabs/MapBuilder Current Version: 0.4.7 How many have used ArcGIS? Python? ArcPy?? For those of you that have used ArcPy, what’s the first thing that comes to mind when you think of ArcPy? Powerful Cumbersome Not Intuitive Automate ArcGIS with Python to Streamline Geographic Data Analysis © Ryan Lambert, Front Range Community College, 2017
Why Automate Data Processing? “The future of data science is automation.” – Jen Underwood “…eliminate the cut-and-paste drudge work…” – Andy Leonard Source: http://sqlblog.com/blogs/andy_leonard/archive/2017/03/12/why-automate.aspx And that brings us to automating ArcGIS, and automation in general. The future of data science includes a lot of spatial analysis. Automate ArcGIS with Python to Streamline Geographic Data Analysis © Ryan Lambert, Front Range Community College, 2017
Why Automate ArcGIS? GUI is slow and cumbersome Reduction in Error Various Zoom Levels Headers/Footers Large number of data sets Automate ArcGIS with Python to Streamline Geographic Data Analysis © Ryan Lambert, Front Range Community College, 2017
Common ArcGIS Steps Import data file with Student Addresses Geocode Addresses Spatial Joins Export Polished Map(s) to PDF MapBuilder was created to perform these basic actions… Automate ArcGIS with Python to Streamline Geographic Data Analysis © Ryan Lambert, Front Range Community College, 2017
Site here All the “Common ArcGIS tasks” are what I call the “Boring Stuff”. (geocoding, spatial joins, exporting PDFs…) Automate ArcGIS with Python to Streamline Geographic Data Analysis © Ryan Lambert, Front Range Community College, 2017
Automation Boosts Productivity PDF Maps Created for External Use Not only an exponential increase in # of maps produced, but this allows more time to review the information, and it’s so easy to make minor adjustments to the model and run the whole set again. Automate ArcGIS with Python to Streamline Geographic Data Analysis © Ryan Lambert, Front Range Community College, 2017
Demo 1 Basic Example Starts w/ Template MXD Exports PDF Output showing FRCC Service Area MXD: Think of Templates in Word – Avery 5XXX labels example Automate ArcGIS with Python to Streamline Geographic Data Analysis © Ryan Lambert, Front Range Community College, 2017
Bootstrap.py (step 1) Import MapBuilder from local directory, not installed via pip. Automate ArcGIS with Python to Streamline Geographic Data Analysis © Ryan Lambert, Front Range Community College, 2017
Bootstrap.py (step 2) Automate ArcGIS with Python to Streamline Geographic Data Analysis © Ryan Lambert, Front Range Community College, 2017
Bootstrap.py (step 3) List of Dictionaries required for OUTPUT_LIST Automate ArcGIS with Python to Streamline Geographic Data Analysis © Ryan Lambert, Front Range Community College, 2017
Get the Bounding Box You Want Hover Cursor for Max values Get the Bounding Box You Want Hover Cursor for Min values x y Automate ArcGIS with Python to Streamline Geographic Data Analysis © Ryan Lambert, Front Range Community College, 2017
MapBuilder: config.py Automate ArcGIS with Python to Streamline Geographic Data Analysis © Ryan Lambert, Front Range Community College, 2017
Multiple Data Files Enrollment Maps for Each: Campus Program Ethnicity Processed in “Iterations” This is the main purpose I had in mind when starting this project. Administration wants maps showing all sorts of cross-cuts of our student population. Automate ArcGIS with Python to Streamline Geographic Data Analysis © Ryan Lambert, Front Range Community College, 2017
Demo 2: Multiple Inputs and Outputs Use Excel Data “Splitter” (VBA) Geocodes ~ 1,500 Addresses from 2 .txt files Spatially Joins Geocoded addresses to Census Tracts Exports 11 PDFs Going from simple to complex Automate ArcGIS with Python to Streamline Geographic Data Analysis © Ryan Lambert, Front Range Community College, 2017
Favorite beer in header, line 2 Output name in Header, line 3 (lines up with name see 2 slides ago) Automate ArcGIS with Python to Streamline Geographic Data Analysis © Ryan Lambert, Front Range Community College, 2017
Geocoding Addresses From Demo 2 bootstrap.py Automate ArcGIS with Python to Streamline Geographic Data Analysis © Ryan Lambert, Front Range Community College, 2017
Geocoding Caveat Currently only supports Local Geocoder Planning to support ESRI Online Geocoder in Q3 2017 Automate ArcGIS with Python to Streamline Geographic Data Analysis © Ryan Lambert, Front Range Community College, 2017
Spatial Joins Automate ArcGIS with Python to Streamline Geographic Data Analysis © Ryan Lambert, Front Range Community College, 2017
More About Outputs Outputs are a “List” of “Dictionaries” MapBuilder Saves One PDF per Output in the list Automate ArcGIS with Python to Streamline Geographic Data Analysis © Ryan Lambert, Front Range Community College, 2017
Custom Output Module Automate ArcGIS with Python to Streamline Geographic Data Analysis © Ryan Lambert, Front Range Community College, 2017
Using Custom Output Module In bootstrap.py… Automate ArcGIS with Python to Streamline Geographic Data Analysis © Ryan Lambert, Front Range Community College, 2017
Flexible and Customizable Automate ArcGIS with Python to Streamline Geographic Data Analysis © Ryan Lambert, Front Range Community College, 2017
Project Geodatabase Generated Automatically Stores Data used Demo 2 – Can see table and Feature Class loaded to created GDB Automate ArcGIS with Python to Streamline Geographic Data Analysis © Ryan Lambert, Front Range Community College, 2017
One More Map… Automate ArcGIS with Python to Streamline Geographic Data Analysis © Ryan Lambert, Front Range Community College, 2017
Summary Major Boost to Productivity Created 12 maps in < 45 minutes, while presenting Easy Annual updates: Update data and run again Automate ArcGIS with Python to Streamline Geographic Data Analysis © Ryan Lambert, Front Range Community College, 2017
Get MapBuilder & Get Involed http://bit.ly/2rPN3vb Note: Case Sensitive! Project Code Slide Deck Recording of Presentation (Coming soon!) Link to GitHub w/ Issues and Wiki Combine with Slide 31 (Get Involved!) Automate ArcGIS with Python to Streamline Geographic Data Analysis © Ryan Lambert, Front Range Community College, 2017
Automate ArcGIS with Python to Streamline Geographic Data Analysis Thank You Ryan.Lambert@frontrange.edu Automate ArcGIS with Python to Streamline Geographic Data Analysis Automate ArcGIS with Python to Streamline Geographic Data Analysis © Ryan Lambert, Front Range Community College, 2017