Python Map Automation Beyond the Basics of arcpy.mapping

Similar documents
Python: Beyond the Basics. John Lam Esri China (Hong Kong) Richard Chau Esri China (Hong Kong)

Working with Printing Service: Advanced Topics JEFF MOULDS TANU HOQUE

Enabling High-Quality Printing in Web Applications. Tanu Hoque & Scott Moore

Enabling High-Quality Printing in Web Applications

Enabling High-Quality Printing in Web Applications

Python Map Automation: Introduction to arcpy.mapping / arcpy.mp. Jeff Barrette

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

Designing and Using Cached Map Services

ArcGIS Pro: Mapping & Visualization. David Watkins, Edie Punt &

Developing Qt Apps with the Runtime SDK

What is map scripting (aka arcpy.mapping arcpy arcpy.mapping)? mapping)? mapping)? A new mapping module that is part of the geoprocessing ArcPy site s

Automating Geodatabase Creation with Geoprocessing

Esri Production Mapping An Introduction

Network Analyst: An Introduction

Caching Imagery Using ArcGIS

Enabling High-Quality Printing in Web Applications. Tanu Hoque & Craig Williams

ArcMap Tips and Tricks

ArcMap: Tips and Tricks

An Introduction to Data Interoperability

Customizing the Operations Dashboard for ArcGIS

Working with Metadata in ArcGIS

Python Raster Analysis

Network Analysis with ArcGIS Online and On-premise Services

Advanced Parcel Editing. Amy Andis Tim Hodson

ArcPad An Introduction

Data Interoperability An Introduction

ArcGIS Viewer for Flex An Introduction

ArcGIS Viewer for Silverlight Advanced Topics

Best Practices for Designing Effective Map Services

Building Java Apps with ArcGIS Runtime SDK

Python - Raster Analysis

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

ArcGIS Viewer for Microsoft Silverlight An Introduction

Using Python with ArcGIS

ArcGIS for Server Performance and Scalability Optimizing GIS Services

Creating Great Labels Using Maplex

Using Python with ArcGIS

PYTHON. Scripting for ArcGIS. writeoutput = Inputfc = ar. .ext.{) OUtpUt fc =.. Paul A. Zandbergen. axcpy random. .arcpy, Describe (' is.

Getting the most from the Maplex Label Engine

Building Applications with the ArcGIS Runtime SDK for WPF

Network Analyst: Performing Network Analysis

Creating Apps Using ArcGIS Online Templates. Matt Kennedy

Working with Feature Layers. Russell Brennan Gary MacDougall

Python Getting Started

Using Geoprocessing Services in Web Applications. Kelly Hutchins, Kevin Hibma, Monica Joseph

Using Arcpy.mapping and ArcGIS Server Admin API to Automate Services

ArcGIS Runtime SDK for Java: A Beginner s Guide. Mark Baird JC Malott

ArcGIS Desktop The Road Ahead. Amadea Azerki

Topology in the Geodatabase an Introduction. Erik Hoel Doug Morgenthaler

Getting Started with ArcGIS Runtime. Jeff Shaner David Cardella

The Road to Runtime. Mark Cederholm UniSource Energy Services Flagstaff, Arizona

Managing Imagery and Raster Data Using Mosaic Datasets

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

Configuring ArcGIS Enterprise in Disconnected Environments

Web AppBuilder Presented by

Python: Beyond the Basics. Michael Rhoades

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

ArcGIS Viewer for Flex Advanced Topics

ICIT. Brian Hiller ESRI Account Manger. What s new in ArcGIS 10

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

ArcGIS Enterprise: Portal Administration BILL MAJOR CRAIG CLEVELAND

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

PYTHON: BUILDING GEOPROCESSING TOOLS. David Wynne, Geri Miller

Creating Mosaic Datasets and Publishing Image Services using Python

Developing Mobile Apps with the ArcGIS Runtime SDK for.net

Esri Maps for SharePoint

Applications of Python Scripting: Creating Custom Map Books in ArcGIS 10

Data Interoperability An Introduction

Building tools with Python

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

Getting Started with ArcGIS Runtime SDK for Java SE

Using Python with ArcGIS

Network Analyst Creating Network Datasets

ArcGIS Enterprise Security: Advanced. Gregory Ponto & Jeff Smith

ArcGIS Desktop: Fundamentals of Cartography

What Makes a good content item GREAT?

ArcGIS Desktop: Making Maps in ArcMap

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

Introduction to Web AppBuilder for ArcGIS: JavaScript Apps Made Easy

Getting Started with ArcGIS Runtime SDK for Qt. Thomas Dunn & Nandini Rao

Developers Road Map to ArcGIS Desktop and ArcGIS Engine

Administering Your Microsoft SQL Server Geodatabase

Hosted Feature Service to Custom Report with Data Driven Pages

ArcPad An Introduction

A Developers Guide To Mobile GIS. David Cardella, Jeff Shaner

ArcGIS Enterprise: Advanced Topics in Administration. Thomas Edghill & Moginraj Mohandas

Architecting ArcGIS Server Solutions for Linux and Solaris

ArcGIS for Server Michele Lundeen

Working with Scientific Data in ArcGIS Platform

What s New in Desktop 10.1

ArcGIS for Server: What s New. Philip Heede, Jay Theodore

Lidar Working with LAS Datasets

ArcMap Editing Tips and Tricks. Sean Jones

What s s Coming in ArcGIS 10 Desktop

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

Securing ArcGIS Server Services An Introduction

Architect your deployment using Chef

ArcGIS Pro. Terminology Guide

ArcGIS Pro Terminology Guide

ArcGIS Pro Terminology Guide

Transcription:

2013 Esri International User Conference July 8 12, 2013 San Diego, California Technical Workshop Python Map Automation Beyond the Basics of arcpy.mapping Jeff Barrette Jeff Moulds Esri UC2013. Technical Workshop.

Basic rules Reference an MXD using a path or current keyword - When using CURRENT - Always run in foreground - May need to refresh (e.g., RefreshActiveView) Uniquely name all the objects you want to reference Pre-author MXDs with all possible elements - Can t create new objects (e.g., north arrow, data frames) - Author the extra elements off the page - No "New Map" function, so keep an empty MXD available This is not a replacement for ArcObjects we are trying to draw a line in the sand Us You The Line

Sample Application Jeff Barrette http://esriurl.com/5907 Esri UC2013. Technical Workshop.

What s new topic http://esriurl.com/4597 What s new Mapping What s new for automating map workflows

Cloning elements http://esriurl.com/5908 You can now clone text and graphic elements This allows you to automate things like dynamic tables Example: vertl = arcpy.mapping.listlayoutelements( mxd, GRAPHIC_ELEMENT, VerticalLine )[0] vertl.elementpositionx = xpos; vertl.elementpositiony = 4 vert1.elementheight = 3 for line in range(1, numcolumns+1): vert_clone = vertline.clone("_clone") xpos = xpos + colwidth vert_clone.elementpositionx = xpos

Symbology classes http://esriurl.com/5909 Layer.symbologyType r/o : string Returns: GRADUATED_COLORS, GRADUATED_SYMBOLS, UNIQUE_VALUES RASTER_CLASSIFIED, OTHER Layer.symbology r/o : Symbology Class Example: if lyr.symbologytype == GRADUATED_COLORS : lyr.symbology.numclasses = 10 lyr.symbology.valuefield = POP2007 General notes, can NOT change: - Symbology class - Individual symbols use arcpy.mapping.updatelayer - Classification methods

arcpy.mapping group http://esriurl.com/5915

Performance tips Don t keep calling list functions import map as arcpy.mapping item1 = map.listlayoutelements(mxd,wildcard="item1") item2 = map.listlayoutelements(mxd,wildcard="item2") item3 = map.listlayoutelements(mxd,wildcard="item3") Call them once instead and iterate through the items for elm in arcpy.mapping.listlayoutelements(mxd): if elm.name =="Item1": item1 = elm if elm.name =="Item2": item2 = elm if elm.name =="Item3": item3 = elm

Performance tips (continued) Or even better, use dictionaries dict = {} for elm in arcpy.mapping.listlayoutelements(mxd): dict[elm.name] = elm dict["item1"].text = "Dictionaries" dict["item2"].text = "are really" dict["item3"].text = "COOL!!!"

Authoring geoprocessing tasks with Python scripts Things to consider help topic: http://esriurl.com/4656 Before import arcpy path = r C:\Project\maps... arcpy.mapping.exporttopdf(mxd, path + "\\output.pdf") After import arcpy path = arcpy.env.scratchworkspace... arcpy.mapping.exporttopdf(mxd, path + "\\output.pdf") arcpy.setparameterastext(1,path + "\\output.pdf")

Functions in 10.1 for server publishing and printing - ConvertWebMapToMapDocument() - Use with the ArcGIS web APIs for advanced web map printing workflows Web application arcpy.mapping High-quality output (e.g. PDF) - CreateMapSDDraft() - Automate publishing map documents to map services Map document arcpy.mapping Map service

Server printing out-of-the-box ArcGIS Server 10.1 and the ArcGIS web APIs support web map printing via print services. - Out-of-the-box print service and template maps ship with Server - Print services sample: http://esriurl.com/6465 Related Session: Supporting High-Quality Printing in Web Applications with ArcGIS for Server (Wednesday @ 8:30 am Room 15A)

Advanced server printing with arcpy.mapping Build web apps with customized versions of the 10.1 outof-the-box print service Web application arcpy.mapping High-quality output (e.g. PDF) New arcpy.mapping method for converting Web Maps to MapDocuments: - ConvertWebMapToMapDocument () - ConvertWebMapToMapDocument (webmap_json, {template_mxd}, {notes_gdb}, {extra_conversion_options})

Advanced server printing with arcpy.mapping Full capabilities of arcpy.mapping on the document - Modify content (e.g. replace service layers with local vector data for high quality printing) - Export using custom options - Export data driven pages - Export to PDF and insert additional pages Return a printer-friendly output file (PDF, PNG, etc.) Online help and examples http://esriurl.com/4600

Demo: High quality server printing with arcpy.mapping Print high quality vector layers instead of tiled image cache of service layers Vector layers will be staged in template map documents Map service tiled cache Vector data

Demo: High quality server printing with arcpy.mapping Reference the custom arcpy.mapping based GP service

Demo: High quality server printing with arcpy.mapping Arcpy.mapping code used in custom geoprocessing service Get web map JSON Get template MXD 1 Create new MXD based on web map Remove service layers Export PDF Output file of job 2

High quality server printing with arcpy.mapping Two tutorials: - Basic high-quality web map printing: http://esriurl.com/4601 - Advanced web map printing: http://esriurl.com/4602 Georeferencing Layers in map Layers in legend

Publishing map services with arcpy.mapping arcpy.mapping.createmapsddraft() Workflow from map document to map service Use python for: - Publishing automated analysis results - Scheduled service upgrades - Batch migration from 10.0 to 10.1 Prepare MXDs (arcpy.mapping) arcpy.mapping.mapdocument() Create SDDraft and edit XML (arcpy.mapping) arcpy.mapping.createmapsddraft() Stage and Publish Map Service (arcpy server GP tools) arcpy.stageservice_server() arcpy.uploadservicedefinition_server()

Publishing map services with arcpy.mapping Sample: CreateMapSDDraft (arcpy.mapping) Reference a MXD Server connection, service properties, etc Create and analyze sddraft for errors, warnings, etc Stage and publish Map Service Don t publish if errors exist Online help: http://esriurl.com/4598

Publishing other service types with python 10.1: - arcpy.createmapsddraft() 10.1 sp1: - arcpy.creategpsddraft() - Create geoprocessing services with Python - arcpy.createimagesddraft() 10.2: - Create image services with Python - arcpy.creategeocodesddraft() - Create geocoding services with Python

Related sessions Tuesday: 10:15-11:30am : Introduction to arcpy.mapping : Room 8 Wednesday: 8:30 9:45am : Supporting High-Quality Printing with AGS : Room 15A 10:15-11:30am : Introduction to arcpy.mapping : Room 1 A/B 3:15-4:30pm : Beyond the Basics of arcpy.mapping : Room 1 A/B Thursday: 8:30-09:45am : Beyond the Basics of arcpy.mapping : Room 8 Esri UC2013. Technical Workshop. Building Map Books in ArcGIS

Thank you Please fill out the session evaluation First Offering ID: 1298 Second Offering ID: 1220 Online www.esri.com/ucsessionsurveys Paper pick up and put in drop box Esri UC2013. Technical Workshop.