This 3 day Python course covers all the fundamentals of the python programming language as well as its use in a GIS environment through the use of the ArcPy GIS library. The course shows you how Python scripting allows you to automate workflows and manipulate and change map documents and layers; how its flexibility and fully functional scripting language helps you take your use of ArcGIS to the next level by improving efficiencies and optimising processes.
You will learn: the basics of the Python language; the skills to leverage ArcPy and the Python scripting language to perform and automate Geoprocessing tasks in ArcGIS; to use ArcPy to automate data processing and analysis tasks; how map related tasks can be automated with python scripts with applications for bulk map production, map packaging and data migration using ArcPy.mapping.
The start of your python programming journey. On the first day you will learn the basics of the language which will make up the foundation of your future programming projects.
You will learn:
- Python Basics: Syntax, Variables, Looping, Functions and Lists
- Python in the Field Calculator
- Accessing Data: Using cursors and lists to access GIS data
- Geoprocessing: Accessing Geometry and toolbox features
- Manipulating Map Documents
Exercise 1 – Python Basics: What is Python?; Python Window; What is ArcPy?; Python Variables; Python if Statement; Python Iteration (Looping); Exporting Models to Python Scripts; Editing Python Scripts Using IDLE; Outputting Messages from Python; Optional exercises: Running Python Code from Command Line; and using Python in Field Calculator
Exercise 2 – Non-tool Functions of ArcPy: ArcPy Documentation; Cursors in ArcPy; and Using List Functions of ArcPy; Optional exercises: Cursor Challenge 2.1 ; List Functions Challenge 2.2 through to 2.4
Exercise 3 – Python for Geoprocessing (ArcPy): Using Geometry in Python; Creating Parameters; Optional exercises: Cursor Challenges 3.1 through to 3.5
Exercise 4 – Python for Mapping (ArcPy.mapping): What is ArcPy.mapping?; Modifying Maps, Layers and Data Frames using Python; Exporting Maps to PDF using Python
Optional exercises: Python for Mapping Challenge 4.1 and 4.2
This part of the course focusses on providing you with the skills to fully leverage ArcPy and the Python scripting language to perform and automate Geoprocessing tasks in ArcGIS. Using ArcPy to automate data processing and analysis tasks will greatly improve the way you leverage the capabilities of ArcGIS by improving efficiency and developing more resilient methodologies.
You will learn:
- Using ESRI’s Python Template for ArcPy
- Nesting scripts
- Using the Data Access Module in ArcPy
- Performing Data Management Automation with Cursors
- Using ArcPy for automating Geodatabase tasks
- Working with Python toolboxes
- Integrating Python with Model Builder
- Creating Desktop Add-ins using Python
Exercise 1 – Using Esri’s PythonTemplate for ArcPy: Where to find the PythonTemplate for ArcPy?; What’s in the PythonTemplate for ArcPy?; Header of Comments - import statements - Testing Script in IDLE - pass statement - Running Python script tool - sys.argv - Functions are defined using def - try/except - Defining another Function in same Script; Running Python scripts (with parameters) from Python scripts; Optional exercises: Miscellaneous Features of Esri’s PythonTemplate script; and Comments (#) vs docstrings (""")
Exercise 2 – Data Access Module: Format String Syntax; Working with Python dictionaries; Data Access Module (arcpy.da); List Geodatabase Domains and Permitted Values - dictionary returned for Coded Value domains - tuple returned for Range domains; Access Domains for Feature Classes; Access Domains for Feature Classes (Challenge); Comparing Original and New Update Cursor Performance; Using arcpy.da.UpdateCursor to Move Features - Arcpy.da. UpdateCursor Challenge; Walking through Workspaces to Process Spatial Data Types
Exercise 3 – Python Toolboxes: Add Python Script Tool to Standard Toolbox; Add Python Script Challenge; Convert Standard Toolbox to Python Toolbox; Create New Python Toolbox from Catalog Window; Create New Python Toolbox from Python Template for *.pyt; Code New Tool in New Python Toolbox; Add New Parameter to Tool in Python Toolbox
Exercise 4 – Creating Desktop Add-ins using Python: What is a Python Add-in?; Create an Add-in Project; Create an Add-in Toolbar; Testing the Add-in; Sharing Python Add-ins
The final day of training explores how mapping tasks can be completed with increased efficiency by using the Arcpy.mapping module. The majority of map related tasks can be automated with python scripts with applications for bulk map production, map packaging and data migration.
You will learn:
- The ArcPy.mapping module
- Automating Map Production
- Creating Map Series
- Bulk Updating Maps
- Bulk Repairing of Broken Links
- Bulk Map Exporting
Exercise 1 – ArcPy.mapping Module: ArcPy.mapping Module Text Element; Legend Element; Challenge 1.1 - Picture Element; Challenge 1.2 - North Arrow
Exercise 2 – Automating Map Production: Setting Up a Map Document; Using Group Layers; Naming Layout Elements; Moving Layout Elements before PDF Export; Move Text from off the Layout; Challenge 2.1 - Move Text Relative to the Legend; Challenge 2.2 - Labelling
Exercise 3 – Creating Map Series: Creating Map Series; Challenge 3.1 – Change Selection; Challenge 3.2 – Legend Limit; Optional exercise: Challenge 3.3 – Legend Limit
Exercise 4 – Updating Map Data Sources: Updating Data in Maps; Challenge 4.1 - Parameters; Challenge 4.2 – Subfolders