Introduction to Geoprocessing Scripts Using Python. Student Edition

Similar documents
Managing Imagery Using ArcGIS

Esri News for Water & Wastewater Fall 2016

ArcGIS 9 Using ArcGIS StreetMap

Analysis & Geoprocessing: Case Studies Problem Solving

An ESRI White Paper May 2009 ArcGIS 9.3 Geocoding Technology

Using the ModelBuilder of ArcGIS 9 for Landscape Modeling

An Introduction to Geoprocessing

Network Analyst: Automating Workflows with Geoprocessing

AGENDA. Effective Geodatabase Management. Presentation Title. Using Automation. Mohsen Kamal. Name of Speaker Company Name

Fundamentals of ModelBuilder

EDUCATION GIS CONFERENCE Geoprocessing with ArcGIS Pro. Rudy Prosser GISP CTT+ Instructor, Esri

THE LIST USABILITY PUG 2007

ArcGIS Pro: What s New in Analysis. Rob Elkins

ArcGIS Pro: Scripting with Python. John Jennifer Duerr:

Sharing Data Between CAD and GIS Systems. Lien Alpert Phil Sanchez

Preparing Street Data for Use with the Network Dataset

Analysis and Geoprocessing Sessions and Demo Theater Presentations

UNIGIS University of Salzburg. Module: ArcGIS for Server Lesson: Online Spatial analysis UNIGIS

Lab Assignment 5 Geoprocessing Service. Due Date: 01/24/2014

Spatial Analysis with ArcGIS Pro. Krithica Kantharaj, Esri

ARCGIS DESKTOP DEMO (GEOCODING, SERVICE AREAS, TABULAR & SPATIAL JOINS)

Esri and Autodesk What s Next?

Geocoding An Introduction

GIS Programming Practicuum

Provides the data analysis, management and

ModelBuilder Getting Started

Session 3: Python Geoprocessing

ArcGIS Pro: What s New in Analysis

Creating Geoprocessing Services

Watershed Sciences 4930 & 6920 GEOGRAPHIC INFORMATION SYSTEMS

How to put the Image Services in the Living Atlas to Work in Your GIS. Charlie Frye, Chief Cartographer Esri, Redlands

Realigning Historical Census Tract and County Boundaries

Geography 281 Map Making with GIS Project Ten: Mapping and Spatial Analysis

Packaging Projects, Maps and Layers. Shilpi Jain Melanie Summers

in ArcMap By Mike Price, Entrada/San Juan, Inc.

Using 3D thematic symbology to display features in a scene

Building Java Apps with ArcGIS Runtime SDK

Making the Most of the New Mapping Capabilities

GPS Pathfinder Office Software or the GPS Analyst Extension for ESRI ArcGIS Software: Resolving the NAD 83 Datum Transformation Issue

ArcGIS Tutorial: Geocoding Addresses

Managing Imagery and Raster Data. Peter Becker

Street Canyon Tool. User Guide CERC

A Server-Based Tool for Automating MODFLOW Simulations for Well Permitting Decision Support

Implementing Analysis in ArcGIS Runtime

ArcGIS Runtime: Analysis. Lucas Danzinger Mark Baird Mike Branscomb

GPS Pathfinder Office Software or GPS Analyst Extension for ESRI ArcGIS Software: Resolving the NAD 83 Datum Transformation Issue

Oracle Real-Time Scheduler

GEORGIA WETLANDS TOOL

ArcGIS Runtime SDK for Java: Building Applications. Eric

ARC HYDRO GROUNDWATER TUTORIALS

Rapid Airfield Construction Decision Support Toolset

White paper brief IdahoView Imagery Services: LISA 1 Technical Report no. 2 Setup and Use Tutorial

Qt Developing ArcGIS Runtime Applications. Eric

Modeling & Simulation Capability for Consequence Management

Working with Geocoding APIs

The American Community Survey. An Esri White Paper August 2017

ARIS B.V. ARIS CycloSearch for ArcMap User's Manual

Presentation Skills Workshop

An Approach to Integrating Modeling & Simulation Interoperability

Pin Tool. Assembly Guide. For Research Use Only. Not for use in diagnostic procedures. Original Instructions

ArcGIS Pro: Tips & Tricks

Lecture 8 Geocoding. Dr. Zhang Spring, 2017

VGIN Geocoding Service

GEOGRAPHIC MODELLING AND ANALYSIS

Using Geoprocessing Services with ArcGIS Web Mapping APIs

PADS Layout for an Integrated Project. Student Workbook

ERDAS APOLLO Essentials Web Map Tile Service (WMTS): custom tile matrix sets

Objectives Learn how to import and display shapefiles with and without ArcObjects. Learn how to convert the shapefiles to GMS feature objects.

A Web Application That Can Save You Money

Projects Connector User Guide

Copyright The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

SECTION GEOGRAPHIC INFORMATION SYSTEM (GIS)

Daniel Sasso William E. Biles. Department of Industrial Engineering University of Louisville Louisville, KY 40292, USA

Geocoding Techniques and Options for US and International Locations. Thomas Oaks Tosia Shall

Working with Elevation Services. Cody Benkelman

Geocoding and Address Matching

STUDENT GUIDE Version 1.3 FINAL

Upgrading Common Workflows from 10.2.x to 100.x with ArcGIS Runtime SDK for.net. Melanie Whalen & Lauren Boyd

Using Point Cloud with GIS and Virtual Reality to Manage and Inspect Building Plumbing

GIS Module GMS 7.0 TUTORIALS. 1 Introduction. 1.1 Contents

Geocoding Techniques and Options for US and International Locations. Brady Hoak, Tosia Shall

v. 8.0 GMS 8.0 Tutorial GIS Module Shapefile import, display, and conversion Prerequisite Tutorials None Time minutes

A Practical Guide to Carlson Software Fundamentals 2015 Rick Ellis Douglas L. Aaberg, PLS Duke Gardner

GXL-Satellite Mosaic Preparation. Training Guide

Esri UC 2014 Technical Workshop

Destination Branding: GIS Shows All Your Community Has to Offer

A Practical Guide to Carlson Software Fundamentals 2018 Rick Ellis Douglas L. Aaberg, PLS Duke Gardner

GEOGRAPHIC INFORMATION SYSTEMS Lecture 22: Field Mapping with GPS

Soccer Award Certificates. Award

Emergency Siren Sound Propagation and Coverage Optimization Analysis

Monitoring land-cover change by satellite

A Little Spare Change

GIS Tips and Tricks. Jennifer Harrison President, Inner Corridor Technologies, Inc. ESRI Certified Training Partner (CTP) Let s talk about chocolate

MODULE 1 HAZARDOUS EMERGENCY DECISIONS

Remote Sensing in an

Geocoding Techniques and Options for US and International Locations

Spatial Analyst is an extension in ArcGIS specially designed for working with raster data.

PCB Layout in the Xpedition Flow. Student Workbook

Military Tools for ArcGIS: An Introduction. Derek Foll Lyle Wright

LAKEMASTER GUIDE. Spend less time searching and more time fishing GETTING STARTED...3,4

Transcription:

Introduction to Geoprocessing Scripts Using Python Student Edition

Copyright 2013 Esri All rights reserved. Course version 6.0. Version release date August 2013. Printed in the United States of America. The information contained in this document is the exclusive property of Esri. This work is protected under United States copyright law and other international copyright treaties and conventions. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying and recording, or by any information storage or retrieval system, except as expressly permitted in writing by Esri. All requests should be sent to Attention: Contracts and Legal Services Manager, Esri, 380 New York Street, Redlands, CA 92373-8100 USA. EXPORT NOTICE: Use of these Materials is subject to U.S. export control laws and regulations including the U.S. Department of Commerce Export Administration Regulations (EAR). Diversion of these Materials contrary to U.S. law is prohibited. The information contained in this document is subject to change without notice. US Government Restricted/Limited Rights Any software, documentation, and/or data delivered hereunder is subject to the terms of the License Agreement. The commercial license rights in the License Agreement strictly govern Licensee's use, reproduction, or disclosure of the software, data, and documentation. In no event shall the US Government acquire greater than RESTRICTED/ LIMITED RIGHTS. At a minimum, use, duplication, or disclosure by the US Government is subject to restrictions as set forth in FAR 52.227-14 Alternates I, II, and III (DEC 2007); FAR 52.227-19(b) (DEC 2007) and/or FAR 12.211/ 12.212 (Commercial Technical Data/Computer Software); and DFARS 252.227-7015 (DEC 2011) (Technical Data - Commercial Items) and/or DFARS 227.7202 (Commercial Computer Software and Commercial Computer Software Documentation), as applicable. Contractor/Manufacturer is Esri, 380 New York Street, Redlands, CA 92373-8100, USA. @esri.com, 3D Analyst, ACORN, Address Coder, ADF, AML, ArcAtlas, ArcCAD, ArcCatalog, ArcCOGO, ArcData, ArcDoc, ArcEdit, ArcEditor, ArcEurope, ArcExplorer, ArcExpress, ArcGIS, ArcGlobe, ArcGrid, ArcIMS, ARC/INFO, ArcInfo, ArcInfo Librarian, ArcLessons, ArcLocation, ArcLogistics, ArcMap, ArcNetwork, ArcNews, ArcObjects, ArcOpen, ArcPad, ArcPlot, ArcPress, ArcPy, ArcReader, ArcScan, ArcScene, ArcSchool, ArcScripts, ArcSDE, ArcSdl, ArcSketch, ArcStorm, ArcSurvey, ArcTIN, ArcToolbox, ArcTools, ArcUSA, ArcUser, ArcView, ArcVoyager, ArcWatch, ArcWeb, ArcWorld, ArcXML, Atlas GIS, AtlasWare, Avenue, BAO, Business Analyst, Business Analyst Online, BusinessMAP, CityEngine, CommunityInfo, Database Integrator, DBI Kit, EDN, Esri, Esri Team GIS, Esri The GIS Company, Esri The GIS People, Esri The GIS Software Leader, FormEdit, GeoCollector, Geographic Design System, Geography Matters, Geography Network, GIS by Esri, GIS Day, GIS for Everyone, GISData Server, JTX, MapIt, Maplex, MapObjects, MapStudio, ModelBuilder, MOLE, MPS Atlas, PLTS, Rent-a-Tech, SDE, SML, Sourcebook America, SpatiaLABS, Spatial Database Engine, StreetMap, Tapestry, the ARC/INFO logo, the ArcGIS logo, the ArcGIS Explorer logo, the ArcPad logo, the Esri globe logo, the Esri Press logo, the GIS Day logo, the MapIt logo, The Geographic Advantage, The Geographic Approach, The World's Leading Desktop GIS, Water Writes, www.arcgis.com, www.esri.com, www.geographynetwork.com, www.gis.com, www.gisday.com, and Your Personal Geographic Information System are trademarks, service marks, or registered marks in the United States, the European Community, or certain other jurisdictions. CityEngine is a registered trademark of Procedural AG and is distributed under license by Esri. Other companies and products or services mentioned herein may be trademarks, service marks or registered marks of their respective mark owners.

Course introduction Introduction Course goals Additional resources Installing the course data 1 Running scripts in Python Integrated Development Environment (IDE) Running scripts in Python window Exercise 1A: Use the PyScripter IDE (Instructor-led) Open and configure PyScripter Run the script The ArcPy site package ArcPy functions and classes The ArcPy modules Choosing a scripting environment Tips and best practices Exercise 1B: Run scripts in Python Buffer schools in Python window Update script in PyScripter Verify results in ArcMap 2 Describing data The Describe function Generic Describe object properties Feature class Describe properties Raster Describe properties Describing a feature class and raster Fill-in-the-blank Exercise 2: Work with the Describe object Describe a feature class and a geodatabase Describe a list of feature classes Clip raster datasets with Describe object properties Challenge: Describe dataset and coordinate system properties 3 Automating scripts with lists The ArcPy List functions Explore the ArcPy List functions i

Working with List functions List data Exercise 3: Automate scripts with the ArcPy List functions List field properties Buffer feature classes Verify script results 4 Working with Selections Selection tools in ArcMap Terms commonly used when working with selections Tools that accept Feature Layers Working with a selection The MakeFeatureLayer tool The FieldInfo object The AddFieldDelimiters function Determining a workflow Creating feature layer and get feature count Exercise 4: Work with Feature Layers and Selections Create new script Create Feature Layers Perform Spatial Selection Create Feature Class from selection 5 Working with Cursors The arcpy.da cursors Using the SearchCursor Using the UpdateCursor Using the InsertCursor Using the arcpy.da.editor Tips and best practices for arcpy.da Cursors Exercise 5: Work with cursors Research the da Cursors Work with the da.searchcursor Work with the da.updatecursor Work with the da.insertcursor ii

6 Working with Geometry objects Creating geometry objects Creating Point objects Creating Polyline geometry objects Creating Polygon geometry objects The geometry object Constructing multipart geometry Constructing multipart polygons Creating and updating feature geometry Using geometry object with geoprocessing tool Accessing geometry objects Exercise 6: Work with geometry objects and cursors Create geometry objects Access Shape geometry Update existing features (Optional) Create new features (Optional) Use geometry object with geoprocessing tool 7 Sharing scripts Terms commonly used when sharing scripts Scripting advantages in ArcMap Making scripts dynamic Creating and sharing a script tool Advantages of attaching a script to a custom tool Using the Add Script wizard Running a script Sharing a script Plan out a project Exercise 7: Share scripts through geoprocessing packages Add pseudocode to the script Write script code Attach script to custom tool Run script in ArcMap Share results as a geoprocessing package Verify the geoprocessing package iii

8 Debugging scripts and handling runtime errors Debugging workflow Debugging scripts in PyScripter Handling script exceptions Getting geoprocessing messages Working with exceptions Using Exception as e Using arcpy.executeerror Using the traceback module Tips and best practices Exercise 8: Debug scripts and handle exceptions Debug the script Incorporate a try-except statement block Incorporate an Exception as e statement Incorporate an arcpy.executeerror exception class Use the traceback module Challenge: Challenge 9 Automating map production The arcpy.mapping module Terms commonly used when working with the arcpy.mapping module Using the arcpy.mapping module to modify map document contents Referencing the map document Listing map document contents Managing layers Managing layout elements Publishing maps Exporting maps and reports Customizing symbology for map layers Exercise 9: Work with map document contents Access map document in ArcMap Access map document in script Update layer symbology Update layout text elements Verify changes in ArcMap Challenge: Automate script for multiple mxds Appendixes Appendix A: Esri data license agreement iv

Appendix B: Answers to lesson review questions Lesson 1: Running scripts in Python Lesson 2: Describing data Lesson 3: Automating scripts with lists Lesson 4: Working with Selections Lesson 5: Working with Cursors Lesson 6: Working with Geometry objects Lesson 7: Sharing scripts Lesson 8: Debugging scripts and handling runtime errors Lesson 9: Automating map production v