SlideShare a Scribd company logo
1 of 28
ArcPy Overview – Extending and
Automating ArcGIS with Python
Clinton Dow – Geoprocessing Product Engineer @ Esri
http://www.slideshare.net/ClintonDow/arcpy-overview-slides
Before we begin…
Free stuff!
• Free ArcGIS Pro
- http://bit.ly/ArcPyProTrial
• Free ArcGIS Online Account
- http://bit.ly/PythonAGOLTrial
• ArcPy Documentation
- http://bit.ly/ArcPyDocs
• ArcPy Resources
- http://bit.ly/ArcPyResources
About MeClinton Dow – Calgary, AB > Los Angeles, CA
• Product Engineer @ Esri
- ArcPy
- Conda
- Charts and Graphs
• GIS Developer @ Matrix Solutions Inc.
- GeoProcessing Tool Development
- Oil & Gas Applications
- Environmental Applications
- Civil Engineering Projects
esri
Environmental Systems Research Institute, Inc.
• Founded in 1969
• HQ in Redlands California
- 41 Offices Globally
- Employees from 67 Countries
• Supports Government, Military
and Civilian organizations
• Currently hiring Experienced Python Developers/Product
Engineers 
- http://bit.ly/ArcPyJobs
ArcGIS
Product Information
• Industry-leading Commercial GIS Software Suite
• ArcGIS for Desktop
- Initial release in 1999
- Current version of ArcMap 10.4
- ArcGIS Pro included since 10.3 – January 2015
- Current version 1.2
• ArcGIS for Server
- Current version 10.4
- Portal for ArcGIS included since 10.2
• ArcGIS Online
ArcPy
ArcGIS Python site-package
• Introduced in ArcGIS 10.0
- June 29, 2010
• Successor to arcgisscripting module
• Create tools leveraging ArcGIS
- In-Application Geoprocessing Tools and Scripting
- REST Web Services
- Standalone Python Programs
• 1,000+ ArcPy-based Tools Included in ArcGIS
Python at Esri
Other Uses of Python
• Test Framework
- Proprietary test-runner and reporting
• Queries in ArcGIS
- Tools not based on ArcPY
- Calculate Field Tool
- Map Label Expressions
• CityEngine
- Python Scripting
- Built-in script editor
Agenda
• Python in ArcGIS: Moving Forward
- Python 2 vs. 3
- ArcGIS 10.x vs ArcGIS Pro
• Tip #1 –ArcPy in an IDE
• Automating ArcGIS with Python
- Scripting Complex Workflows
- Service Endpoint Automation
Agenda
• Tip #2 – There must be a better way!
• Extending ArcGIS with Python
- Python Standard Library
- Tour of Complementary Python Packages
• Tip #3 – Comprehensions with Cursors
• The future of Python in ArcGIS
- Managing Packages and Environments with Conda
- Jupyter Notebook
ArcPy: Moving Forward
‘Python is the language of GIS.’ – Bill Moreland, Esri Dev Summit 2016
• Python 2 vs. 3 in ArcGIS
- Python 2 End of Support Countdown Clock!
- ArcGIS 10.4  Python 2.7.10
- ArcGIS for Server  Python 2.7.10
- ArcGIS Pro 1.2  Python 3.4.3
- ArcGIS Pro 1.3+  Decoupled Python!
ArcPy: Moving Forward
‘Python is the language of GIS.’ – Bill Moreland, Esri Dev Summit 2016
•ArcGIS 10.x to ArcGIS Pro
- ArcObjects SDK will not move to Pro
- Great time to be a Python GIS Developer!
- ArcObjects high cost of maintenance and very tightly
coupled to COM
- Rewrite code in Python 3 in Pro
- Platform agnostic vs. .NET code
- Web Services
- Vast library of Packages
- Improved features in Pro
- … it’s Python and not .NET 
Tip #1 – ArcPy in an IDE
GIS from the comfort of your development environment
• Integrated Development Environments
- Debuggers
- Test Frameworks
- Coverage
- PyLint/pycodestyle
- Version Control Integration
- Refactoring Tools
- Virtual Environment Support
- AutoComplete
Tip #1 – ArcPy in an IDE
GIS from the comfort of your development environment
• Recommended IDEs
- PyCharm
- Python Tools for Visual
Studio
- Spyder
- Eclipse with PyDev
- Wingware
Automating ArcGIS with Python
Toolboxes, Python Toolboxes, Interpreters, Command Line, Services…
• Multiple ways to create tools
- ArcGIS Toolbox (.tbx)
- Python Toolbox (.pyt)
- Stand-alone Scripts (.py)
- Interactive Python Window
• Decouple logic code from Toolbox
- Testing!!
• Distutils to create packaged code
Sharing
Install into tools as needed
Automating ArcGIS with Python
Modularized Code Demo
Automating ArcGIS with Python
Distutils demo
Extending ArcGIS with Python Modules
Python is a ‘Batteries Included’ Programming Language
• Python Standard Library
- Distutils
- Collections
- Itertools
- XML
- JSON
- UnitTest
- -asyncio
Tip #2 – There Must Be A Better Way!
Never Underestimate The Python Standard Library!
• Raymond Hettinger
- Transforming Code Into Beautiful, Idiomatic Python
- https://www.youtube.com/watch?v=OSGv2VnC0go
- Beyond PEP 8 – Best Practices for Beautiful, Intelligible Code
- https://www.youtube.com/watch?v=wf-BqAjZb8M
Extending ArcGIS with Python Modules
Utilize the Extended Python Ecosystem in your ArcGIS Tools
• Scientific
- Jupyter
- IPython
- NumPy
- SciPy
- Pandas
- PySAL
- SciKit Learn
• Utility
- Requests
- Arrow
- Xlrd/xlwt
- Chardet
• Visualization
- Bokeh
- Plotly
• Web-Scraping
- BeautifulSoup
- Scrapy
- Tweepy
Tip #3 – Filter & Map with Comprehensions
Using Pure Python Data Types to Work with Feature Classes
import arcpy
data_path = r"C:Pathtofeatureclass"
def cursor_comprehension_map(path):
# Map function
# m = map(lambda x: x[0] + 1.0, [row for row in arcpy.da.SearchCursor(path, ['OID@'])])
m = [row[0] + 1 for row in arcpy.da.SearchCursor(path, ['OID@'])]
return m
def cursor_comprehension_filter(path):
# Filter function
# f = filter(lambda x: x ==1, [row for row in arcpy.da.SearchCursor(path, ['OID@'])])
f = [row for row in arcpy.da.SearchCursor(path, ['OID@']) if row[0] == 1]
return f
Tip #3 – Comprehensions with Cursors
Using Pure Python Data Types to Work with Feature Classes
import arcpy
data_path = r"C:Pathtofeatureclass"
def cursor_list_comprehension(path):
l = [row for row in arcpy.da.SearchCursor(path, ["SHAPE@", "Language"])]
return l
def cursor_dictionary_comprehension(path):
d = {row[0]: row[1:] for row in arcpy.da.SearchCursor(path, ["OID@", "MsgText", "Language"])}
return d
def cursor_generator_comprehension(path):
g = (row for row in arcpy.da.SearchCursor(path, ["SHAPE@", "Language"]))
return g
def cursor_generator_statement(path):
with arcpy.da.SearchCursor(path, ["OID@", "MsgText"]) as cursor:
for row in cursor:
yield str(row[0])
Tip #3 – Collections Example
Using Pure Python Data Types to Work with Feature Classes
from collections import Counter
import arcpy
data_path = r"C:Usersclin8331DesktopTemptw.gdbtw_lang_europe"
def count_field_occurances(data_path):
c = Counter()
with arcpy.da.SearchCursor(data_path, ["OID@", "Language"]) as cursor:
for row in cursor:
c[row[1]] += 1
return c
The Future of Python in ArcGIS
Continuum Analytics’ conda VirtualEnv & Package Manager
• Conda integration into ArcGIS
- Advanced Python Package Management
- Curated channels of scientific Python packages
- Includes C and Fortran compiler
- Create and host your own conda packages
- Easily share your code with the GIS community
- Built-In Virtual Environment Support
- Manage multiple environments with access to ArcPy
- Easily share environments
- Trivializes dependency issues
The Future of Python in ArcGIS
Screenshots of conda UI
The Future of Python in ArcGIS
Jupyter Notebook/IPython Integration
• Interactive Scientific Computing with ArcGIS Support
- Interact with ArcGIS for Server and ArcGIS Online via Jupyter Notebooks
- ArcPy Integration coming
- Embed maps with simple, pythonic API
- Access scalable, web-based GeoProcessing Services
- GeoEnrichment Services
- GeoAnalytics Servers
- All the regular functionality of notebooks
- Pandas/matplotlib magic methods
- Github integration
- Easily Sharable
Help us make ArcPy better!
• GeoNet
- http://geonet.esri.com
- https://geonet.esri.com/community/developers/gis-developers/python
• ArcGIS Ideas
- http://ideas.arcgis.com
• Conda Support Email
- conda@esri.com
• ArcPy Café
- https://arcpy.wordpress.com/
Conclusion
• ArcGIS
- Industry-leading GIS Platform
- Big push to move towards Python
- Really big customers (NASA, ESA, Governments, Fortune 500 companies…)
- Lots of opportunity for Python programmers
• ArcPy
- Moving from Python 2 to 3
- Conda support
- Start in ArcGIS Pro if you’re learning
• We are hiring! Talk to me if you are interested in learning more.
Thank You!
Clinton Dow - Contact Info
cdow@esri.com
http://lnked.in/cdow
http://www.slideshare.net/ClintonDow/arcpy-overview-slides

More Related Content

Recently uploaded

Don't Miss Out: Strategies for Making the Most of the Ethena DigitalOpportunity
Don't Miss Out: Strategies for Making the Most of the Ethena DigitalOpportunityDon't Miss Out: Strategies for Making the Most of the Ethena DigitalOpportunity
Don't Miss Out: Strategies for Making the Most of the Ethena DigitalOpportunityApp Ethena
 
RACHEL-ANN M. TENIBRO PRODUCT RESEARCH PRESENTATION
RACHEL-ANN M. TENIBRO PRODUCT RESEARCH PRESENTATIONRACHEL-ANN M. TENIBRO PRODUCT RESEARCH PRESENTATION
RACHEL-ANN M. TENIBRO PRODUCT RESEARCH PRESENTATIONRachelAnnTenibroAmaz
 
Chizaram's Women Tech Makers Deck. .pptx
Chizaram's Women Tech Makers Deck.  .pptxChizaram's Women Tech Makers Deck.  .pptx
Chizaram's Women Tech Makers Deck. .pptxogubuikealex
 
proposal kumeneger edited.docx A kumeeger
proposal kumeneger edited.docx A kumeegerproposal kumeneger edited.docx A kumeeger
proposal kumeneger edited.docx A kumeegerkumenegertelayegrama
 
General Elections Final Press Noteas per M
General Elections Final Press Noteas per MGeneral Elections Final Press Noteas per M
General Elections Final Press Noteas per MVidyaAdsule1
 
INDIAN GCP GUIDELINE. for Regulatory affair 1st sem CRR
INDIAN GCP GUIDELINE. for Regulatory  affair 1st sem CRRINDIAN GCP GUIDELINE. for Regulatory  affair 1st sem CRR
INDIAN GCP GUIDELINE. for Regulatory affair 1st sem CRRsarwankumar4524
 
Testing with Fewer Resources: Toward Adaptive Approaches for Cost-effective ...
Testing with Fewer Resources:  Toward Adaptive Approaches for Cost-effective ...Testing with Fewer Resources:  Toward Adaptive Approaches for Cost-effective ...
Testing with Fewer Resources: Toward Adaptive Approaches for Cost-effective ...Sebastiano Panichella
 
Engaging Eid Ul Fitr Presentation for Kindergartners.pptx
Engaging Eid Ul Fitr Presentation for Kindergartners.pptxEngaging Eid Ul Fitr Presentation for Kindergartners.pptx
Engaging Eid Ul Fitr Presentation for Kindergartners.pptxAsifArshad8
 
cse-csp batch4 review-1.1.pptx cyber security
cse-csp batch4 review-1.1.pptx cyber securitycse-csp batch4 review-1.1.pptx cyber security
cse-csp batch4 review-1.1.pptx cyber securitysandeepnani2260
 
Internship Presentation | PPT | CSE | SE
Internship Presentation | PPT | CSE | SEInternship Presentation | PPT | CSE | SE
Internship Presentation | PPT | CSE | SESaleh Ibne Omar
 
Testing and Development Challenges for Complex Cyber-Physical Systems: Insigh...
Testing and Development Challenges for Complex Cyber-Physical Systems: Insigh...Testing and Development Challenges for Complex Cyber-Physical Systems: Insigh...
Testing and Development Challenges for Complex Cyber-Physical Systems: Insigh...Sebastiano Panichella
 
05.02 MMC - Assignment 4 - Image Attribution Lovepreet.pptx
05.02 MMC - Assignment 4 - Image Attribution Lovepreet.pptx05.02 MMC - Assignment 4 - Image Attribution Lovepreet.pptx
05.02 MMC - Assignment 4 - Image Attribution Lovepreet.pptxerickamwana1
 
Application of GIS in Landslide Disaster Response.pptx
Application of GIS in Landslide Disaster Response.pptxApplication of GIS in Landslide Disaster Response.pptx
Application of GIS in Landslide Disaster Response.pptxRoquia Salam
 
GESCO SE Press and Analyst Conference on Financial Results 2024
GESCO SE Press and Analyst Conference on Financial Results 2024GESCO SE Press and Analyst Conference on Financial Results 2024
GESCO SE Press and Analyst Conference on Financial Results 2024GESCO SE
 
Quality by design.. ppt for RA (1ST SEM
Quality by design.. ppt for  RA (1ST SEMQuality by design.. ppt for  RA (1ST SEM
Quality by design.. ppt for RA (1ST SEMCharmi13
 
A Guide to Choosing the Ideal Air Cooler
A Guide to Choosing the Ideal Air CoolerA Guide to Choosing the Ideal Air Cooler
A Guide to Choosing the Ideal Air Coolerenquirieskenstar
 
THE COUNTRY WHO SOLVED THE WORLD_HOW CHINA LAUNCHED THE CIVILIZATION REVOLUTI...
THE COUNTRY WHO SOLVED THE WORLD_HOW CHINA LAUNCHED THE CIVILIZATION REVOLUTI...THE COUNTRY WHO SOLVED THE WORLD_HOW CHINA LAUNCHED THE CIVILIZATION REVOLUTI...
THE COUNTRY WHO SOLVED THE WORLD_HOW CHINA LAUNCHED THE CIVILIZATION REVOLUTI...漢銘 謝
 

Recently uploaded (17)

Don't Miss Out: Strategies for Making the Most of the Ethena DigitalOpportunity
Don't Miss Out: Strategies for Making the Most of the Ethena DigitalOpportunityDon't Miss Out: Strategies for Making the Most of the Ethena DigitalOpportunity
Don't Miss Out: Strategies for Making the Most of the Ethena DigitalOpportunity
 
RACHEL-ANN M. TENIBRO PRODUCT RESEARCH PRESENTATION
RACHEL-ANN M. TENIBRO PRODUCT RESEARCH PRESENTATIONRACHEL-ANN M. TENIBRO PRODUCT RESEARCH PRESENTATION
RACHEL-ANN M. TENIBRO PRODUCT RESEARCH PRESENTATION
 
Chizaram's Women Tech Makers Deck. .pptx
Chizaram's Women Tech Makers Deck.  .pptxChizaram's Women Tech Makers Deck.  .pptx
Chizaram's Women Tech Makers Deck. .pptx
 
proposal kumeneger edited.docx A kumeeger
proposal kumeneger edited.docx A kumeegerproposal kumeneger edited.docx A kumeeger
proposal kumeneger edited.docx A kumeeger
 
General Elections Final Press Noteas per M
General Elections Final Press Noteas per MGeneral Elections Final Press Noteas per M
General Elections Final Press Noteas per M
 
INDIAN GCP GUIDELINE. for Regulatory affair 1st sem CRR
INDIAN GCP GUIDELINE. for Regulatory  affair 1st sem CRRINDIAN GCP GUIDELINE. for Regulatory  affair 1st sem CRR
INDIAN GCP GUIDELINE. for Regulatory affair 1st sem CRR
 
Testing with Fewer Resources: Toward Adaptive Approaches for Cost-effective ...
Testing with Fewer Resources:  Toward Adaptive Approaches for Cost-effective ...Testing with Fewer Resources:  Toward Adaptive Approaches for Cost-effective ...
Testing with Fewer Resources: Toward Adaptive Approaches for Cost-effective ...
 
Engaging Eid Ul Fitr Presentation for Kindergartners.pptx
Engaging Eid Ul Fitr Presentation for Kindergartners.pptxEngaging Eid Ul Fitr Presentation for Kindergartners.pptx
Engaging Eid Ul Fitr Presentation for Kindergartners.pptx
 
cse-csp batch4 review-1.1.pptx cyber security
cse-csp batch4 review-1.1.pptx cyber securitycse-csp batch4 review-1.1.pptx cyber security
cse-csp batch4 review-1.1.pptx cyber security
 
Internship Presentation | PPT | CSE | SE
Internship Presentation | PPT | CSE | SEInternship Presentation | PPT | CSE | SE
Internship Presentation | PPT | CSE | SE
 
Testing and Development Challenges for Complex Cyber-Physical Systems: Insigh...
Testing and Development Challenges for Complex Cyber-Physical Systems: Insigh...Testing and Development Challenges for Complex Cyber-Physical Systems: Insigh...
Testing and Development Challenges for Complex Cyber-Physical Systems: Insigh...
 
05.02 MMC - Assignment 4 - Image Attribution Lovepreet.pptx
05.02 MMC - Assignment 4 - Image Attribution Lovepreet.pptx05.02 MMC - Assignment 4 - Image Attribution Lovepreet.pptx
05.02 MMC - Assignment 4 - Image Attribution Lovepreet.pptx
 
Application of GIS in Landslide Disaster Response.pptx
Application of GIS in Landslide Disaster Response.pptxApplication of GIS in Landslide Disaster Response.pptx
Application of GIS in Landslide Disaster Response.pptx
 
GESCO SE Press and Analyst Conference on Financial Results 2024
GESCO SE Press and Analyst Conference on Financial Results 2024GESCO SE Press and Analyst Conference on Financial Results 2024
GESCO SE Press and Analyst Conference on Financial Results 2024
 
Quality by design.. ppt for RA (1ST SEM
Quality by design.. ppt for  RA (1ST SEMQuality by design.. ppt for  RA (1ST SEM
Quality by design.. ppt for RA (1ST SEM
 
A Guide to Choosing the Ideal Air Cooler
A Guide to Choosing the Ideal Air CoolerA Guide to Choosing the Ideal Air Cooler
A Guide to Choosing the Ideal Air Cooler
 
THE COUNTRY WHO SOLVED THE WORLD_HOW CHINA LAUNCHED THE CIVILIZATION REVOLUTI...
THE COUNTRY WHO SOLVED THE WORLD_HOW CHINA LAUNCHED THE CIVILIZATION REVOLUTI...THE COUNTRY WHO SOLVED THE WORLD_HOW CHINA LAUNCHED THE CIVILIZATION REVOLUTI...
THE COUNTRY WHO SOLVED THE WORLD_HOW CHINA LAUNCHED THE CIVILIZATION REVOLUTI...
 

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Arcpy overview slides

  • 1. ArcPy Overview – Extending and Automating ArcGIS with Python Clinton Dow – Geoprocessing Product Engineer @ Esri http://www.slideshare.net/ClintonDow/arcpy-overview-slides
  • 2. Before we begin… Free stuff! • Free ArcGIS Pro - http://bit.ly/ArcPyProTrial • Free ArcGIS Online Account - http://bit.ly/PythonAGOLTrial • ArcPy Documentation - http://bit.ly/ArcPyDocs • ArcPy Resources - http://bit.ly/ArcPyResources
  • 3. About MeClinton Dow – Calgary, AB > Los Angeles, CA • Product Engineer @ Esri - ArcPy - Conda - Charts and Graphs • GIS Developer @ Matrix Solutions Inc. - GeoProcessing Tool Development - Oil & Gas Applications - Environmental Applications - Civil Engineering Projects
  • 4. esri Environmental Systems Research Institute, Inc. • Founded in 1969 • HQ in Redlands California - 41 Offices Globally - Employees from 67 Countries • Supports Government, Military and Civilian organizations • Currently hiring Experienced Python Developers/Product Engineers  - http://bit.ly/ArcPyJobs
  • 5. ArcGIS Product Information • Industry-leading Commercial GIS Software Suite • ArcGIS for Desktop - Initial release in 1999 - Current version of ArcMap 10.4 - ArcGIS Pro included since 10.3 – January 2015 - Current version 1.2 • ArcGIS for Server - Current version 10.4 - Portal for ArcGIS included since 10.2 • ArcGIS Online
  • 6. ArcPy ArcGIS Python site-package • Introduced in ArcGIS 10.0 - June 29, 2010 • Successor to arcgisscripting module • Create tools leveraging ArcGIS - In-Application Geoprocessing Tools and Scripting - REST Web Services - Standalone Python Programs • 1,000+ ArcPy-based Tools Included in ArcGIS
  • 7. Python at Esri Other Uses of Python • Test Framework - Proprietary test-runner and reporting • Queries in ArcGIS - Tools not based on ArcPY - Calculate Field Tool - Map Label Expressions • CityEngine - Python Scripting - Built-in script editor
  • 8. Agenda • Python in ArcGIS: Moving Forward - Python 2 vs. 3 - ArcGIS 10.x vs ArcGIS Pro • Tip #1 –ArcPy in an IDE • Automating ArcGIS with Python - Scripting Complex Workflows - Service Endpoint Automation
  • 9. Agenda • Tip #2 – There must be a better way! • Extending ArcGIS with Python - Python Standard Library - Tour of Complementary Python Packages • Tip #3 – Comprehensions with Cursors • The future of Python in ArcGIS - Managing Packages and Environments with Conda - Jupyter Notebook
  • 10. ArcPy: Moving Forward ‘Python is the language of GIS.’ – Bill Moreland, Esri Dev Summit 2016 • Python 2 vs. 3 in ArcGIS - Python 2 End of Support Countdown Clock! - ArcGIS 10.4  Python 2.7.10 - ArcGIS for Server  Python 2.7.10 - ArcGIS Pro 1.2  Python 3.4.3 - ArcGIS Pro 1.3+  Decoupled Python!
  • 11. ArcPy: Moving Forward ‘Python is the language of GIS.’ – Bill Moreland, Esri Dev Summit 2016 •ArcGIS 10.x to ArcGIS Pro - ArcObjects SDK will not move to Pro - Great time to be a Python GIS Developer! - ArcObjects high cost of maintenance and very tightly coupled to COM - Rewrite code in Python 3 in Pro - Platform agnostic vs. .NET code - Web Services - Vast library of Packages - Improved features in Pro - … it’s Python and not .NET 
  • 12. Tip #1 – ArcPy in an IDE GIS from the comfort of your development environment • Integrated Development Environments - Debuggers - Test Frameworks - Coverage - PyLint/pycodestyle - Version Control Integration - Refactoring Tools - Virtual Environment Support - AutoComplete
  • 13. Tip #1 – ArcPy in an IDE GIS from the comfort of your development environment • Recommended IDEs - PyCharm - Python Tools for Visual Studio - Spyder - Eclipse with PyDev - Wingware
  • 14. Automating ArcGIS with Python Toolboxes, Python Toolboxes, Interpreters, Command Line, Services… • Multiple ways to create tools - ArcGIS Toolbox (.tbx) - Python Toolbox (.pyt) - Stand-alone Scripts (.py) - Interactive Python Window • Decouple logic code from Toolbox - Testing!! • Distutils to create packaged code Sharing Install into tools as needed
  • 15. Automating ArcGIS with Python Modularized Code Demo
  • 16. Automating ArcGIS with Python Distutils demo
  • 17. Extending ArcGIS with Python Modules Python is a ‘Batteries Included’ Programming Language • Python Standard Library - Distutils - Collections - Itertools - XML - JSON - UnitTest - -asyncio
  • 18. Tip #2 – There Must Be A Better Way! Never Underestimate The Python Standard Library! • Raymond Hettinger - Transforming Code Into Beautiful, Idiomatic Python - https://www.youtube.com/watch?v=OSGv2VnC0go - Beyond PEP 8 – Best Practices for Beautiful, Intelligible Code - https://www.youtube.com/watch?v=wf-BqAjZb8M
  • 19. Extending ArcGIS with Python Modules Utilize the Extended Python Ecosystem in your ArcGIS Tools • Scientific - Jupyter - IPython - NumPy - SciPy - Pandas - PySAL - SciKit Learn • Utility - Requests - Arrow - Xlrd/xlwt - Chardet • Visualization - Bokeh - Plotly • Web-Scraping - BeautifulSoup - Scrapy - Tweepy
  • 20. Tip #3 – Filter & Map with Comprehensions Using Pure Python Data Types to Work with Feature Classes import arcpy data_path = r"C:Pathtofeatureclass" def cursor_comprehension_map(path): # Map function # m = map(lambda x: x[0] + 1.0, [row for row in arcpy.da.SearchCursor(path, ['OID@'])]) m = [row[0] + 1 for row in arcpy.da.SearchCursor(path, ['OID@'])] return m def cursor_comprehension_filter(path): # Filter function # f = filter(lambda x: x ==1, [row for row in arcpy.da.SearchCursor(path, ['OID@'])]) f = [row for row in arcpy.da.SearchCursor(path, ['OID@']) if row[0] == 1] return f
  • 21. Tip #3 – Comprehensions with Cursors Using Pure Python Data Types to Work with Feature Classes import arcpy data_path = r"C:Pathtofeatureclass" def cursor_list_comprehension(path): l = [row for row in arcpy.da.SearchCursor(path, ["SHAPE@", "Language"])] return l def cursor_dictionary_comprehension(path): d = {row[0]: row[1:] for row in arcpy.da.SearchCursor(path, ["OID@", "MsgText", "Language"])} return d def cursor_generator_comprehension(path): g = (row for row in arcpy.da.SearchCursor(path, ["SHAPE@", "Language"])) return g def cursor_generator_statement(path): with arcpy.da.SearchCursor(path, ["OID@", "MsgText"]) as cursor: for row in cursor: yield str(row[0])
  • 22. Tip #3 – Collections Example Using Pure Python Data Types to Work with Feature Classes from collections import Counter import arcpy data_path = r"C:Usersclin8331DesktopTemptw.gdbtw_lang_europe" def count_field_occurances(data_path): c = Counter() with arcpy.da.SearchCursor(data_path, ["OID@", "Language"]) as cursor: for row in cursor: c[row[1]] += 1 return c
  • 23. The Future of Python in ArcGIS Continuum Analytics’ conda VirtualEnv & Package Manager • Conda integration into ArcGIS - Advanced Python Package Management - Curated channels of scientific Python packages - Includes C and Fortran compiler - Create and host your own conda packages - Easily share your code with the GIS community - Built-In Virtual Environment Support - Manage multiple environments with access to ArcPy - Easily share environments - Trivializes dependency issues
  • 24. The Future of Python in ArcGIS Screenshots of conda UI
  • 25. The Future of Python in ArcGIS Jupyter Notebook/IPython Integration • Interactive Scientific Computing with ArcGIS Support - Interact with ArcGIS for Server and ArcGIS Online via Jupyter Notebooks - ArcPy Integration coming - Embed maps with simple, pythonic API - Access scalable, web-based GeoProcessing Services - GeoEnrichment Services - GeoAnalytics Servers - All the regular functionality of notebooks - Pandas/matplotlib magic methods - Github integration - Easily Sharable
  • 26. Help us make ArcPy better! • GeoNet - http://geonet.esri.com - https://geonet.esri.com/community/developers/gis-developers/python • ArcGIS Ideas - http://ideas.arcgis.com • Conda Support Email - conda@esri.com • ArcPy Café - https://arcpy.wordpress.com/
  • 27. Conclusion • ArcGIS - Industry-leading GIS Platform - Big push to move towards Python - Really big customers (NASA, ESA, Governments, Fortune 500 companies…) - Lots of opportunity for Python programmers • ArcPy - Moving from Python 2 to 3 - Conda support - Start in ArcGIS Pro if you’re learning • We are hiring! Talk to me if you are interested in learning more.
  • 28. Thank You! Clinton Dow - Contact Info cdow@esri.com http://lnked.in/cdow http://www.slideshare.net/ClintonDow/arcpy-overview-slides

Editor's Notes

  1. 20m
  2. 25m
  3. 30m
  4. 50m
  5. 70m
  6. 70m
  7. 70m