1 / 33

Introduction

Presenter: James Zollweg, Ph.D. Associate Professor of Water Resources and GIS The College at Brockport. Introduction. NYS GIS Association – Python Training, Session 2 – July 17, 2012. 1. Python is an increasingly important part of ArcGIS mapping and geoprocessing

Download Presentation

Introduction

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Presenter: James Zollweg, Ph.D. Associate Professor of Water Resources and GIS The College at Brockport Introduction NYS GIS Association – Python Training, Session 2 – July 17, 2012

  2. 1. Python is an increasingly important part of ArcGIS mapping and geoprocessing 2. Python 'scripting' is a powerful tool for modeling and process automation 3. Build a greater sense of community among GIS professionals in NYS via shared professional development Why a Python Seminar? NYS GIS Association – Python Training, Session 2 – July 17, 2012

  3. 1. The elements of Python – a general purpose programming language 2. ArcPy - provides Python access for all geoprocessing tools, as well as a wide variety of useful functions and classes for working with and interrogating GIS data. 3. Proficiency in ArcGIS mapping and geoprocessing Need to know NYS GIS Association – Python Training, Session 2 – July 17, 2012

  4. Python is a free, cross-platform, open-source programming language that is both powerful and easy to learn. It is widely used and supported. To learn more about Python, visit python.org. Brief Review of Python Essentials NYS GIS Association – Python Training, Session 2 – July 17, 2012

  5. Values and variables NYS GIS Association – Python Training, Session 2 – July 17, 2012

  6. Definite repetition NYS GIS Association – Python Training, Session 2 – July 17, 2012

  7. Indefinite Repetition NYS GIS Association – Python Training, Session 2 – July 17, 2012

  8. Lists NYS GIS Association – Python Training, Session 2 – July 17, 2012

  9. List Layers NYS GIS Association – Python Training, Session 2 – July 17, 2012

  10. List Attributes NYS GIS Association – Python Training, Session 2 – July 17, 2012

  11. Study example scripts Example: ReplaceWithLayerFile.py So, how do you REALLY get started? NYS GIS Association – Python Training, Session 2 – July 17, 2012

  12. Title NYS GIS Association – Python Training, Session 2 – July 17, 2012

  13. Exception Handling NYS GIS Association – Python Training, Session 2 – July 17, 2012

  14. Exception Handling NYS GIS Association – Python Training, Session 2 – July 17, 2012

  15. Title NYS GIS Association – Python Training, Session 2 – July 17, 2012

  16. Rather than scouring scripts for ideas (a good way to learn “in general”), let’s make ArcGIS write code snippets for us! A VERY useful alternative NYS GIS Association – Python Training, Session 2 – July 17, 2012

  17. A familiar geoprocessing operation... NYS GIS Association – Python Training, Session 2 – July 17, 2012

  18. Access the “results” of GP operation NYS GIS Association – Python Training, Session 2 – July 17, 2012

  19. Copy operation to a Python “snippet” NYS GIS Association – Python Training, Session 2 – July 17, 2012

  20. # Replace a layer/table view name with a path to a dataset (which can be a layer file) or create the layer/table view within the script# The following inputs are layers or table views: "recreation"arcpy.Buffer_analysis("recreation","C:/temp/tests/buff3.shp","100 Meters","FULL","ROUND","NONE","#") The snippet NYS GIS Association – Python Training, Session 2 – July 17, 2012

  21. # Replace a layer/table view name with a path to a dataset (which can be a layer file) or create the layer/table view within the script # The following inputs are layers or table views: "recreation“ arcpy.Buffer_analysis("recreation","C:/temp/tests/buff3.shp","100 Meters","FULL","ROUND","NONE","#") The snippet (with <cr>) NYS GIS Association – Python Training, Session 2 – July 17, 2012

  22. (I’ll show how to use Model Builder later in the presentation) Model Builder -> Python NYS GIS Association – Python Training, Session 2 – July 17, 2012

  23. Export to Python script NYS GIS Association – Python Training, Session 2 – July 17, 2012

  24. The result NYS GIS Association – Python Training, Session 2 – July 17, 2012

  25. Excellent source of information NYS GIS Association – Python Training, Session 2 – July 17, 2012

  26. Another example NYS GIS Association – Python Training, Session 2 – July 17, 2012

  27. Output NYS GIS Association – Python Training, Session 2 – July 17, 2012

  28. Beware – repetition does not functionally export fro MB NYS GIS Association – Python Training, Session 2 – July 17, 2012

  29. needs to be replaced with proper Python “for” loop Non-functional Python code generated NYS GIS Association – Python Training, Session 2 – July 17, 2012

  30. Replace with proper Python repetition NYS GIS Association – Python Training, Session 2 – July 17, 2012

  31. Shameless plug for the NYS GIS Association NYS GIS Association – Python Training, Session 2 – July 17, 2012

  32. Members-only site for sharing scripts and snippets “Moderated” and organized Watch for details! The NYS GIS Association “App site” NYS GIS Association – Python Training, Session 2 – July 17, 2012

  33. Congratulations for jousting with a useful, important and difficult topic! jzollweg@brockport.edu Thanks! NYS GIS Association – Python Training, Session 2 – July 17, 2012

More Related