Python: Beyond the Basics. Brittney White

Similar documents
Python: Beyond the Basics. Brittney White, Esri Jordan Douthitt, Pennsylvania State University

Creating Geoprocessing Services and Web Tools. Darren Baird, PE, Esri

Collector for ArcGIS: What s New. Chris LeSueur & James Tedrick

ArcGIS Enterprise: Performance and Scalability Best Practices. Darren Baird, PE, Esri

Python: Beyond the Basics. Michael Rhoades

Real-Time & Big Data GIS: Best Practices. Suzanne Foss Josh Joyner

ArcGIS Enterprise Performance and Scalability Best Practices. Andrew Sakowicz

Introducing Survey123 For ArcGIS

Using SQLite in ArcGIS Python Scripts

Survey123 for ArcGIS: An Introduction. James Tedrick Erin Densford

What s New for Developers in ArcGIS Maura Daffern October 16

An Introduction to Using Lidar with ArcGIS and 3D Analyst

An Introduction to ArcGIS Arcade. Tyson Quink

Python: Working with Feature Data. Ghislain Prince David Wynne

Android Team Awareness Kit (ATAK) and ArcGIS

Using Python with ArcGIS

Advanced Parcel Editing. Amy Andis Tim Hodson

Application of GIS to Cybersecurity. Brian Biesecker Ken Mitchell

Using Python in ArcGIS Steven Beothy May 28, 2013

ArcGIS Enterprise Security: An Introduction. Randall Williams Esri PSIRT

Administering Your ArcGIS Enterprise Portal Bill Major Craig Cleveland

Data Interoperability An Introduction

Scientific and Multidimensional Raster Support in ArcGIS

ArcMap Editing Tips and Tricks. Sean Jones

Understanding and Using Metadata in ArcGIS. Adam Martin Marten Hogeweg Aleta Vienneau

ArcGIS Enterprise Security: An Introduction. Gregory Ponto & Jeff Smith

Best Practices for Designing Effective Map Services

Introduction to Your First ArcGIS Enterprise Deployment. Thomas Edghill & Jonathan Quinn

Working with Feature Layers. Russell Brennan Gary MacDougall

Using Python with ArcGIS

Implementing a Hybrid Approach to ArcGIS. Philip McNeilly and Margaret Jen

Web AppBuilder Presented by

Configuring ArcGIS Enterprise in Disconnected Environments

Real-Time & Big Data GIS: Leveraging the spatiotemporal big data store

Utility Network Management in ArcGIS: Migrating Your Data to the Utility Network. John Alsup & John Long

ICAP - Intelligence Configuration for ArcGIS Pro. Natalie Feuerstein Dan Barnes Joe Bayles

Understanding and using Metadata across the ArcGIS Platform. Aleta Vienneau Marten Hogeweg

ArcGIS Runtime SDKs Building Offline Apps. Nick Furness

ArcGIS Enterprise: Portal Administration BILL MAJOR CRAIG CLEVELAND

Python: Building Geoprocessing Tools

Getting Started with ArcGIS Runtime. Jeff Shaner David Cardella

ArcPy Tips & Tricks. Clinton Dow Geoprocessing Product Esri

High Availability & Disaster Recovery. Witt Mathot

Automating Geodatabase Creation with Geoprocessing

Enabling High-Quality Printing in Web Applications. Tanu Hoque & Jeff Moulds

Architect your deployment using Chef

Python Getting Started

What Makes a good content item GREAT?

ArcGIS Enterprise Security: Advanced. Gregory Ponto & Jeff Smith

Understanding and Working with the OGC Geopackage. Keith Ryden Lance Shipman

BEST PRACTICES FOR MAP DESIGN: ADVANCED

ArcGIS GeoEvent Server: Leveraging Stream Services. Ken Gorton RJ Sunderman

How To Configure & Use Insights for ArcGIS ARAVIND SIVASAILAM MATT THOMAS

Getting Started with Spatial Analyst. Steve Kopp Elizabeth Graham

Accessing and Administering your Enterprise Geodatabase through SQL and Python

Administering Your Microsoft SQL Server Geodatabase

Indexed 3D Scene (I3S) Layers Specification

Working with Scientific Data in ArcGIS Platform

ArcGIS Enterprise: Configuring Backups, Disaster Recovery, and Replication. Harrold Sompotan and Patrick Jackson

Open File Explorer Start Pro with SanFran project Open Locator in SanFran project Open Browser and AGOL with RouteExample Web map.

ArcGIS API for JavaScript: Using Arcade with your Apps. Kristian Ekenes & David Bayer

Extending ArcGIS for Server. Jon Satchwell, Esri Switzerland Cédric Despierre Corporon, Esri France

ArcGIS Data Reviewer: Ensuring Accurate and Complete Data to Meet Your Mission. John Grammer Kevin Pusey

ArcGIS Pro Tasks: Tips and Tricks. Jason Camerano

Integrating Imagery into ArcGIS Runtime Application. Jie Zhang, Zhiguang Han San Jacinto, 5:30 pm 6:30 pm

GeoEvent Server: Introduction

ArcGIS Pro Editing: An Introduction. Jennifer Cadkin & Phil Sanchez

Sharing Web Layers and Services in the ArcGIS Platform. Melanie Summers and Ty Fitzpatrick

Getting Started with Spatial Analyst. Steve Kopp Elizabeth Graham

ArcGIS for Mobile Devices: An Overview. Jeff Shaner Bonnie Stayer

ArcGIS GeoEvent Server: Making 3D Scenes Come Alive with Real-Time Data

Setup Guide for Op Tracker

Securing ArcGIS Server Services An Introduction

ArcGIS Pro Tasks: An Introduction. Jason Camerano Amir Bar-Maor

Collector for ArcGIS: Using Relationships with your Inspection Workflows. Morgan Zhang Kevin Burke

Developing Qt Apps with the Runtime SDK

ArcGIS Enterprise: Architecture & Deployment. Anthony Myers

ArcGIS Runtime SDK for Qt: Building Apps. Koushik Hajra and Lucas Danzinger

ArcGIS Enterprise Extending Services. Bill Major

Leveraging OGC Services in ArcGIS Server. Satish Sankaran, Esri Yingqi Tang, Esri

Data Store Management Best Practices. Bill Major Laurence Clinton

8 Querying and Selecting Data

ArcGIS Enterprise Building Raster Analytics Workflows. Mike Muller, Jie Zhang

Desktop Mapping: Creating Vector Tiles. Craig Williams

Automating Distributed Raster Analysis using the Image Server REST API. Jie Zhang Zikang Zhou Demo Theater 2 - Oasis 1

Corporate Brand Your Vector Basemap. ANDREW GREEN

ArcGIS Server and Portal for ArcGIS An Introduction to Security

Python Map Automation Beyond the Basics of arcpy.mapping

Using Python in ArcGIS Oli Helm May 2, 2013

Network Analysis with ArcGIS Online and On-premise Services

ArcGIS for Server: Publishing and Using Map Services

Network Analyst: Performing Network Analysis

An Introduction to Data Interoperability

Creating Apps Using ArcGIS Online Templates. Matt Kennedy

ArcGIS Online: Three-and-a-Half Ways to Create Tile Layers. Eric Anderson & Adam Eversole Esri Support Services

Working with Printing Service: Advanced Topics JEFF MOULDS TANU HOQUE

Esri Production Mapping: Configuring the Solution for Civilian Topographic Agencies. Sean Granata

Bringing your Data to Life in the ArcGIS API for JavaScript: Vector Tiles. Craig Williams &

ArcGIS for Server: Security

Getting Started with the ArcGIS Runtime SDKs. Dave, Will, Euan

Transcription:

Python: Beyond the Basics Brittney White

Topics Covered Cursors Geometry objects Leveraging other Python modules

Cursors Used to: - Iterate over the set of rows in a table - Insert new rows into a table Two varieties: - arcpy.da cursors (10.1 onwards; significantly faster performance) - Classic cursors (provided only for continuing backward compatibility)

Data Access Module Cursors

Required Arguments Table - The feature class, layer, table, or table view Fields - Single field or list of field names - Index position in fields parameter defines value access # 0 1 2 fields = [ Name, Year, Count ]

Tokens Used as shortcuts in place of field names OID@ The value of the ObjectID field. SHAPE@ A geometry object for the feature. SHAPE@XY A tuple of the feature's centroid x,y coordinates. SHAPE@TRUECENTROID A tuple of the feature's true centroid x,y coordinates. SHAPE@X A double of the feature's x-coordinate. SHAPE@Y A double of the feature's y-coordinate. SHAPE@Z A double of the feature's z-coordinate. SHAPE@M A double of the feature's m-value. SHAPE@JSON The esri JSON string representing the geometry. SHAPE@WKB The well-known binary (WKB) representation for OGC geometry. It provides a portable representation of a geometry value as a contiguous stream of bytes. SHAPE@WKT The well-known text (WKT) representation for OGC geometry. It provides a portable representation of a geometry value as a text string. SHAPE@AREA A double of the feature's area. SHAPE@LENGTH A double of the feature's length.

arcpy.da.searchcursor arcpy.da.searchcursor(in_table, field_names, {where_clause}, {spatial_reference}, {explode_to_points}, {sql_clause})

arcpy.da.searchcursor optional where clause parameter

# Open a Search Cursor, print results table = "Crime_Incidents_2016" fields = ["Shift", "Offense", "Method", "Ward"] qry = " Ward = '6' " with arcpy.da.searchcursor(table, fields, qry) as cursor: for row in cursor: print("shift: {} Offense:{} Method: {} Ward: {}".format(row[0], row[1], row[2], row[3]))

# Open a Search Cursor, print results table = "Crime_Incidents_2016" fields = ["Shift", "Offense", "Method", "Ward"] qry = " Ward = '6' " with arcpy.da.searchcursor(table, fields, qry) as cursor: for row in cursor: print("shift: {} Offense:{} Method: {} Ward: {}".format(row[0], row[1], row[2], row[3]))

arcpy.da.updatecursor arcpy.da.updatecursor(in_table, field_names, {where_clause}, {spatial_reference}, {explode_to_points}, {sql_clause}) Method deleterow () updaterow (row) Explanation Deletes the current row Updates the current row in the table.

arcpy.da.updatecursor

arcpy.da.updatecursor

arcpy.da.updatecursor

arcpy.da.insertcursor arcpy.da.insertcursor(in_table, field_names) Method insertrow (row) Explanation Inserts a row into a table.

arcpy.da.insertcursor

arcpy.da.insertcursor

arcpy.da.insertcursor

Working with Geometry Objects Reading geometries - arcpy.da.searchcursor - arcpy.da.updatecursor Writing geometries - arcpy.da.updatecursor - arcpy.da.insertcursor Work with geoprocessing tools

Using geometry as input with geoprocessing tools

Demo: Which buffers overlap?

Which buffers overlap?

Leveraging other Python modules Installed with ArcGIS Pro Examples: arcgis scipy pandas The Python Standard Library Examples: os urllib zipfile Additional thirdparty Python packages Examples: beautifulsoup tensorflow scikit-learn

Leveraging other Python modules Python Standard Library - Read a csv with the csv module - Unzip a.zip file with the zipfile module - Download data from the internet with the urllib module - Automatically open an output with the os module - many more Can install other pre-existing Python packages with ArcGIS Pro Python Package Manager

Demo: Python Package Manager

Print Your Certificate of Attendance Print Stations Located at L Street Bridge Tuesday 12:30 pm 6:30 pm GIS Solutions Expo Hall D Wednesday 10:45 am 5:15 pm GIS Solutions Expo Hall D 5:15 pm 6:30 pm GIS Solutions Expo Social Hall D 6:30 pm 9:00 pm Networking Reception National Building Museum

Please Take Our Survey on the App Download the Esri Events app and find your event Select the session you attended Scroll down to find the feedback section Complete answers and select Submit

Python Sessions at #FedGIS Session Tuesday Wednesday Python: An Introduction 1:45 pm 2:45 pm in 202B 8:30 am 9:30 am in 202B Python: Beyond the Basics 4:15 pm 5:15 pm in 208AB 11:00 am 12:00 pm in 202B Using Python in ArcGIS Enterprise Python: Building Geoprocessing Tools Data Science in ArcGIS Using Python and R 8:30 am 9:30 am in 201 5:15 pm 6:15 pm in 201 4:00 pm 5:00 pm in 202B Machine Learning in ArcGIS 4:15 pm 5:15 pm in 202 A 8:30 am 9:30 am in 202A