Top Banner
Python: Map Automation in Pro Jeff Barrette Jeff Moulds
22

Python: Map Automation in Pro - Esri...Python: Map Automation in Pro, 2017 Esri User Conference--Presentation, 2017 Esri User Conference, Created Date 8/11/2017 4:42:34 PM ...

Jun 05, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Python: Map Automation in Pro - Esri...Python: Map Automation in Pro, 2017 Esri User Conference--Presentation, 2017 Esri User Conference, Created Date 8/11/2017 4:42:34 PM ...

Python: Map Automation in ProJeff Barrette

Jeff Moulds

Page 2: Python: Map Automation in Pro - Esri...Python: Map Automation in Pro, 2017 Esri User Conference--Presentation, 2017 Esri User Conference, Created Date 8/11/2017 4:42:34 PM ...

arcpy.(m)a(p)ping samples

http://esriurl.com/8899

Page 3: Python: Map Automation in Pro - Esri...Python: Map Automation in Pro, 2017 Esri User Conference--Presentation, 2017 Esri User Conference, Created Date 8/11/2017 4:42:34 PM ...
Page 4: Python: Map Automation in Pro - Esri...Python: Map Automation in Pro, 2017 Esri User Conference--Presentation, 2017 Esri User Conference, Created Date 8/11/2017 4:42:34 PM ...

Migrating to ArcGIS Pro

http://esriurl.com/9785

Page 5: Python: Map Automation in Pro - Esri...Python: Map Automation in Pro, 2017 Esri User Conference--Presentation, 2017 Esri User Conference, Created Date 8/11/2017 4:42:34 PM ...

Migrating documents and data sources

Page 6: Python: Map Automation in Pro - Esri...Python: Map Automation in Pro, 2017 Esri User Conference--Presentation, 2017 Esri User Conference, Created Date 8/11/2017 4:42:34 PM ...

Function for importing 10.x documents into ArcGIS Projects

• ArcGISProject.importDocument (document_path, {include_layout})

.MXDs

ArcGIS Pro

Projects

Looping through MXDs in a

folder.

Reference a template APRX.

Import MXD into the APRX.

Save the project.

Page 7: Python: Map Automation in Pro - Esri...Python: Map Automation in Pro, 2017 Esri User Conference--Presentation, 2017 Esri User Conference, Created Date 8/11/2017 4:42:34 PM ...

Function for importing 10.x documents into ArcGIS Projects

• ArcGISProject.importDocument(document_path, {include_layout})

.MXDs

.3DDs.SXDs

ArcGIS Pro

Project

DEMO

Page 8: Python: Map Automation in Pro - Esri...Python: Map Automation in Pro, 2017 Esri User Conference--Presentation, 2017 Esri User Conference, Created Date 8/11/2017 4:42:34 PM ...

Updating Data Sources in ArcGIS Pro

Project/Map/Layer/Table/LayerFile.updateConnectionProperties (current_connection_info,

new_connection_info,

{auto_update_joins_and_relates}…)

Find this path:

Replace it with this path:

.APRXs

Page 9: Python: Map Automation in Pro - Esri...Python: Map Automation in Pro, 2017 Esri User Conference--Presentation, 2017 Esri User Conference, Created Date 8/11/2017 4:42:34 PM ...

Updating Data Sources – examples

Changing a folder

Changing PGDB to FGDB

Works on Layer Files too

DEMO

Page 10: Python: Map Automation in Pro - Esri...Python: Map Automation in Pro, 2017 Esri User Conference--Presentation, 2017 Esri User Conference, Created Date 8/11/2017 4:42:34 PM ...

Updating Data Sources advanced concepts – Layer.connectionProperties• New at Pro

• The entire layer data source object model is exposed as a Python dictionary.

• Use if you need more fine grained control than what’s available in

Project/Map/Layer/Table/LayerFile.updateConnectionproperties()

• Useful when dealing with joins and relates or Enterprise Geodatabase

Access a layer in a map.

File Geodatabase layer

connection properties dictionary

Get layer’s connection properties.

Page 11: Python: Map Automation in Pro - Esri...Python: Map Automation in Pro, 2017 Esri User Conference--Presentation, 2017 Esri User Conference, Created Date 8/11/2017 4:42:34 PM ...

Updating Data Sources advanced concepts – Layer.connectionProperties

• File Geodatabase layer connection Properties (with joins and relates)

• It gets complicated!

Layer’s database

List of relates on the

layer

Relate properties

Page 12: Python: Map Automation in Pro - Esri...Python: Map Automation in Pro, 2017 Esri User Conference--Presentation, 2017 Esri User Conference, Created Date 8/11/2017 4:42:34 PM ...

Core python dictionaries - basics

• A dictionary is an associative array. Any key of the dictionary is associated (or mapped) to a value. The

values of a dictionary can be any Python data type. So dictionaries are unordered key-value-pairs.

Create a dictionary

Access a value in a dictionary

Change a value in a dictionary

Page 13: Python: Map Automation in Pro - Esri...Python: Map Automation in Pro, 2017 Esri User Conference--Presentation, 2017 Esri User Conference, Created Date 8/11/2017 4:42:34 PM ...

Core python dictionaries - basics

• Nested dictionaries - a dictionary within a dictionary.

Create a nested dictionary

Access a value in a dictionary

Change a value in a dictionary

DEMO

Page 14: Python: Map Automation in Pro - Esri...Python: Map Automation in Pro, 2017 Esri User Conference--Presentation, 2017 Esri User Conference, Created Date 8/11/2017 4:42:34 PM ...

Updating Data Sources advanced concepts – Layer.connectionProperties• Enterprise Geodatabase examples – change instance or server

.APRXs

Old geodatabase New geodatabase

Page 15: Python: Map Automation in Pro - Esri...Python: Map Automation in Pro, 2017 Esri User Conference--Presentation, 2017 Esri User Conference, Created Date 8/11/2017 4:42:34 PM ...

Updating Data Sources advanced concepts – Layer.connectionProperties• Enterprise Geodatabase examples – change instance or server

Enterprise Geodatabase

connection properties dictionary

Old database info

New database info

Update connection properties for

project

Get layer’s connection properties.

Page 16: Python: Map Automation in Pro - Esri...Python: Map Automation in Pro, 2017 Esri User Conference--Presentation, 2017 Esri User Conference, Created Date 8/11/2017 4:42:34 PM ...

Updating Data Sources advanced concepts

• Help topic with lots of samples - http://esriurl.com/12905

Page 17: Python: Map Automation in Pro - Esri...Python: Map Automation in Pro, 2017 Esri User Conference--Presentation, 2017 Esri User Conference, Created Date 8/11/2017 4:42:34 PM ...

Migrating

documents and

data sources

Page 18: Python: Map Automation in Pro - Esri...Python: Map Automation in Pro, 2017 Esri User Conference--Presentation, 2017 Esri User Conference, Created Date 8/11/2017 4:42:34 PM ...

Symbology

Page 19: Python: Map Automation in Pro - Esri...Python: Map Automation in Pro, 2017 Esri User Conference--Presentation, 2017 Esri User Conference, Created Date 8/11/2017 4:42:34 PM ...

Layer

Symbology

Simple

UniqueValue

GraduatedColor

GraduatedSymbol

SymbolClassBreak

Group Item

ColorRamp

.symbology

.renderer / .updateRenderer

Renderer

.symbol

.classBreaks

.backgroundSymbol

.symbolTemplate

.groups .items.colorRamp

.symbol

.symbol

.applySymbolFromGallery()

Page 20: Python: Map Automation in Pro - Esri...Python: Map Automation in Pro, 2017 Esri User Conference--Presentation, 2017 Esri User Conference, Created Date 8/11/2017 4:42:34 PM ...

SymbologySupporting Text

Page 21: Python: Map Automation in Pro - Esri...Python: Map Automation in Pro, 2017 Esri User Conference--Presentation, 2017 Esri User Conference, Created Date 8/11/2017 4:42:34 PM ...

Please Take Our Survey on the Esri Events App!

Select the session you attended

Scroll down to find the survey

Complete Answersand Select “Submit”

Download the Esri Events app and find

your event

Python: Map Automation

In Pro

Python: Map Autom …

Page 22: Python: Map Automation in Pro - Esri...Python: Map Automation in Pro, 2017 Esri User Conference--Presentation, 2017 Esri User Conference, Created Date 8/11/2017 4:42:34 PM ...