Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction Presenter: James Zollweg, Ph.D.

Similar presentations


Presentation on theme: "Introduction Presenter: James Zollweg, Ph.D."— Presentation transcript:

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

2 Why a Python Seminar? 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 NYS GIS Association – Python Training, Session 2 – July 17, 2012

3 Need to know 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 NYS GIS Association – Python Training, Session 2 – July 17, 2012

4 Brief Review of Python Essentials
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. 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 So, how do you REALLY get started?
Study example scripts Example: ReplaceWithLayerFile.py 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 A VERY useful alternative
Rather than scouring scripts for ideas (a good way to learn “in general”), let’s make ArcGIS write code snippets for us! 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 The snippet # 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:/tem p/tests/buff3.shp","100 Meters","FULL","ROUND","NONE","#") NYS GIS Association – Python Training, Session 2 – July 17, 2012

21 The snippet (with <cr>)
# 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.s hp","100 Meters","FULL","ROUND","NONE","#") NYS GIS Association – Python Training, Session 2 – July 17, 2012

22 Model Builder -> Python
(I’ll show how to use Model Builder later in the presentation) 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 Non-functional Python code generated
needs to be replaced with proper Python “for” loop 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 The NYS GIS Association “App site”
Members-only site for sharing scripts and snippets “Moderated” and organized Watch for details! NYS GIS Association – Python Training, Session 2 – July 17, 2012

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


Download ppt "Introduction Presenter: James Zollweg, Ph.D."

Similar presentations


Ads by Google