Creating Python Scripts for ArcGIS

Time is valuable. Learn how to create scripts that will streamline your GIS work. This course teaches how to access the Python environment in ArcGIS Pro, script common data management tasks, and automate geoprocessing workflows. You’ll learn techniques to share your scripts so they are easily accessible both inside and outside ArcGIS Pro.

Who Should Attend
GIS analysts, specialists, data processors, and others who want to automate ArcGIS tasks and workflows

After completion of this course you will be able to:
• Apply Python syntax rules, error-handling techniques, and tool validation to create robust scripts in ArcGIS Pro.
• Use lists and loops to repeat geoprocessing tasks within a script to create an efficient, repeatable analysis workflow.
• Use cursors to access geospatial data, edit attributes, and create and modify features.
• Create geoprocessing packages and custom script tools to share your Python scripts with other ArcGIS users.

Completion of ArcGIS Pro: Essential Workflows or Migrating from ArcMap to ArcGIS Pro or equivalent knowledge is required. Some familiarity with Python and basic programming concepts is assumed. Those new to Python should complete the free web course Python for Everyone prior to class.

Course Outline

Python automation for your organization
• Lesson introduction
• Benefits of Python automation
• The Python script creation workflow
• Integrating Python in ArcGIS Pro
• Python development environments
• Accessing Python
• Adding Python packages to ArcGIS Pro

Using Python to access geoprocessing tools
• Lesson introduction
• Viewing parameters in a geoprocessing tool
• Explore the syntax of a geoprocessing tool
• Ways to use variables in a script
• Using variables in a script
• Python troubleshooting techniques
• Troubleshooting errors in a script

Using Describe properties in geoprocessing tools
• Lesson introduction
• Accessing properties with a Describe function
• Identify available Describe function properties
• Describe syntax and usage
• Accessing Describe properties
• Using the da.Describe object in a geoprocessing script
• Using a for loop
• Using a for loop to iterate over lists

Working with cursors
• Lesson introduction
• Types of cursors
• Examine cursors
• Determine which cursor to use
• Exploring cursor syntax
• Using cursors in a workflow
• Applying the cursor workflow

Geoprocessing with geometry objects
• Lesson introduction
• Benefits of geometry objects
• Workflows to create geometry objects
• Discovering polyline geometry objects
• Components of a geometry object
• Discover geometry object methods

Error management techniques
• Lesson introduction
• Types of errors that occur in geoprocessing
• Using try-except statements
• Error handling techniques
• Introducing error handling in Python scripts
• Determine the error handling technique

Creating a Python script tool
• Lesson introduction
• Improving script accessibility
• Components of a Python script tool
• Accepting user input
• Parameter identification

Adding validation to script tools
• Lesson introduction
• Customizing script tool behavior
• Using validation to create customizations
• Validating script tool inputs using ToolValidator methods

Using Python script tools in the platform
• Lesson introduction
• Methods to share a Python script tool
• Determine the appropriate method
• Workflow to share a Python script tool
• Workflow review
• Sharing a web tool within the ArcGIS platform