harnessing python
DESCRIPTION
2013 Esri International User Conference Lightning TalkTRANSCRIPT
Harnessing Python
Blue Raster @blueraster - blueraster.com/blog
Brendan Collins @brendancol - bcdcspatial.blogspot.com
Guido van Rossum | Creator of Python | Benevolent Dictator for Life
Programming for everybody
• Designed as a teaching language– Heavily influenced by ABC (dead language)
– “Perfect language for beginners and non-programmers”
– Adopted by MIT as primary course language• Integrated into ArcGIS Suite in the 9.x series• Matured nicely in ArcGIS 10.x series
You Already Use Python…
Hello C#using System;using System.Collections.Generic;using System.Linq;using System.Text;
namespace hello.world{ class Hello { static void Main() { System.Console.WriteLine( “Hello C#!“ ); } }}
print ‘Hello Python!’
open(‘C:\\fileName.txt’, ‘r’)
Visit documentationhelp.arcgis.com
docs.python.org/2/using
8. A language for all seasons
• Object-oriented; functional; procedural• Desktop; Web; Mobile;
School Boundaries GeodatabaseUS Department of Education
• Effort to collect every school attendance polygon in the country
• Using Python for:– Fuzzy joining of attributes (fuzzy wuzzy library)– Standardizing boundary geometry (arcpy)– QA/QC (arcpy)
Emammal Smithsonian Institute
• Tool to assist citizen scientists collect and analyze wildlife photo
• Uses Python to combine:– EXIF metadata read/write (exiftool)– Thumbnail generation (PIL)– Database connections (django)– Amazon Web Services (boto)
Spatial Data RepositoryMeasure DHS / USAID
• Tool to dynamically create compressed, downloadable packages of spatial data
• Use Python for:– Fancy clip, zip, ship (arcpy)– Automation of ArcGIS tools (arcpy)– Enrichment with using legacy database. (urllib2)– Published as Geoprocessing Service (ArcGIS
Server)
In conclusion…
• If you work with data, work w/Python• Esri’s arcpy library has matured:– data access module is fast– Python toolboxes rock
• Python Resources:– Core Python by Wesley Chun– Follow @pypi on twitter!
Thank You.Visit us at www.blueraster.com!
Blue Raster @blueraster - blueraster.com/blog
Brendan Collins @brendancol - bcdcspatial.blogspot.com