18
Harnessing Python Blue Raster @blueraster - blueraster.com/blog Brendan Collins @brendancol - bcdcspatial.blogspot.com

Harnessing Python

Embed Size (px)

DESCRIPTION

2013 Esri International User Conference Lightning Talk

Citation preview

Page 1: Harnessing Python

Harnessing Python

Blue Raster @blueraster - blueraster.com/blog

Brendan Collins @brendancol - bcdcspatial.blogspot.com

Page 2: Harnessing Python

Guido van Rossum | Creator of Python | Benevolent Dictator for Life

Page 3: Harnessing Python

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

Page 4: Harnessing Python

You Already Use Python…

Page 5: Harnessing Python
Page 6: Harnessing Python
Page 7: Harnessing 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#!“ ); } }}

Page 8: Harnessing Python

print ‘Hello Python!’

Page 9: Harnessing Python

open(‘C:\\fileName.txt’, ‘r’)

Page 10: Harnessing Python

Visit documentationhelp.arcgis.com

docs.python.org/2/using

Page 11: Harnessing Python

8. A language for all seasons

• Object-oriented; functional; procedural• Desktop; Web; Mobile;

Page 12: Harnessing Python

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)

Page 13: Harnessing Python
Page 14: Harnessing Python

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)

Page 15: Harnessing Python
Page 16: Harnessing Python

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)

Page 17: Harnessing Python

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!

Page 18: Harnessing Python

Thank You.Visit us at www.blueraster.com!

Blue Raster @blueraster - blueraster.com/blog

Brendan Collins @brendancol - bcdcspatial.blogspot.com