Python Map Automation – Introduction to arcpy.mapping

Slides:



Advertisements
Similar presentations
Esri International User Conference | San Diego, CA Technical Workshops | Fundamentals: Having Fun with Tables and Reports Kent Marten Matthew Baker July.
Advertisements

How to enter the world of Python Programming for ArcGIS Or, a funny thing happened on the way from an ESRI conference By Katherine Paybins WVAGP Membership.
Technical Workshop 2013 Esri International User Conference July 8–12, 2013 | San Diego, California ArcGIS Tracking Analyst – an Introduction Morakot Pilouk,
Providing Info & Maps to Non-GIS Users & Tips, Tricks in ArcGIS with Gary Moody.
Esri UC2013. Technical Workshop. Technical Workshop 2013 Esri International User Conference July 8–12, 2013 | San Diego, California Editing in ArcMap:
ArcGIS Workflow Manager An Introduction
Technical Workshops | Esri International User Conference San Diego, California ArcMap: Tips and Tricks Miriam Schmidts Jorge Ruiz-Valdepena July 23 – 27,
1/36. 2/36 Something cool …
Network Analysis with Python
Python: An Introduction
Python Map Automation: Introduction to arcpy.mapping / arcpy.mp
ArcGIS Network Analyst: Automating Workflows with Geoprocessing
Esri UC2013. Technical Workshop. Technical Workshop 2013 Esri International User Conference July 8–12, 2013 | San Diego, California Migrating your Data.
Publishing to ArcGIS for Server
Enabling High-Quality Printing in Web Applications
Working with Metadata in ArcGIS Aleta Vienneau. Working with metadata in ArcGIS View metadata Edit metadata Set your metadata style Leverage metadata.
ArcGIS Pro: Mapping and Visualization Craig Williams, Edie Punt, &
Advance Map Automation With Python
Esri Defense Mapping: Cartographic Production
MXD, Maps, Layers arcpy.mapping Classes.
Technical Workshops | Esri International User Conference San Diego, California Creating Geoprocessing Services Kevin Hibma, Scott Murray July 25, 2012.
Esri UC 2014 | Technical Workshop | Python Map Automation – Beyond the Basics of arcpy.mapping Jeff Barrette Jeff Moulds.
Technical Workshops | Esri International User Conference San Diego, California Supporting High-Quality Printing in Web Applications with ArcGIS 10.1 for.
ArcGIS Workflow Manager Introduction
Esri UC2013. Technical Workshop. Technical Workshop 2013 Esri International User Conference July 8–12, 2013 | San Diego, California Supporting High-Quality.
Esri UC2013. Technical Workshop. Technical Workshop 2013 Esri International User Conference July 8–12, 2013 | San Diego, California Building Map Books.
Esri UC2013. Technical Workshop. Technical Workshop 2013 Esri International User Conference July 8–12, 2013 | San Diego, California Sharing Workflows with.
Esri UC2013. Technical Workshop. Technical Workshop 2013 Esri International User Conference July 8–12, 2013 | San Diego, California Automating Geodatabase.
Getting the most out of ArcMap Jack Horton & Jorge Ruiz-Valdepeña.
Esri UC 2014 | Technical Workshop | Creating Geoprocessing Services Kevin Hibma.
Map Books & Dynamic Tables
Desktop Mapping: Building Map Books Jeff Barrette Michael Grossman.
Esri UC 2014 | Demo Theater | Ten ArcMap Tips and Tricks Michael Grossman.
Esri UC2013. Technical Workshop. Technical Workshop 2013 Esri International User Conference July 8–12, 2013 | San Diego, California Python Map Automation.
Publishing GIS Services to ArcGIS Server
Esri UC 2014 | Technical Workshop | Python Map Automation – Introduction to arcpy.mapping Michael Grossman Jeff Barrette.
Esri UC 2014 | Technical Workshop | Editing in ArcMap: An Introduction Lisa Stanners, Phil Sanchez.
Python: Building Geoprocessing Tools David Wynne, Ghislain Prince.
Sharing Maps and Layers to Portal for ArcGIS Melanie Summers, Tom Shippee, Ty Fitzpatrick.
Jeff Barrette Jeff Moulds
ArcGIS Pro Mapping and Visualization
ArcGIS Workflow Manager: Advanced Workflows and Concepts
Desktop Mapping: Building Map Books
PYTHON: AN INTRODUCTION
Shankar Chandrasekaran
Creating Geoprocessing Services
Geoprocessing with ArcGIS for Server
How to enter the world of Python Programming for ArcGIS
Editing Tips and Tricks
Introduction To ArcMap
Python Map Automation – Beyond the Basics of arcpy.mapping
Learning Common GIS Workflows
Learning Common GIS Workflows
Building Map Books in ArcGIS
Automating Geodatabase Administration with Python
ArcGIS Workflow Manager: Using Custom Properties to Automate Workflows
Best Practices for Designing Effective Map Services: Case Studies
ArcGIS Pro: What’s New in Editing and Data Management
Python Map Automation – Beyond the Basics of arcpy.mapping
ModelBuilder – Getting Started
PYTHON: BUILDING GEOPROCESSING TOOLS
Building Map Books in ArcGIS
GIS Lecture: Sharing GIS
Network Analyst – Automating Workflows with Geoprocessing
ArcGIS API for Silverlight – An Introduction
ModelBuilder – Getting Started
Geog 375 Individual Final Programming Project: Automated Thematic Maps
Desktop Mapping: Building Map Books
ArcGIS Pro: An Introduction Overview
Presentation transcript:

Python Map Automation – Introduction to arcpy.mapping Esri International User Conference July 23–27 | San Diego Convention Center Python Map Automation – Introduction to arcpy.mapping Michael Grossman Jeff Barrette

A map scripting environment introduced at 10.0 What is arcpy.mapping? A map scripting environment introduced at 10.0 Python mapping module that is part of the ArcPy site-package An API that allows users to: manage map documents, layer files, and their contents find a layer with data source X and replace with Y update a layer’s symbology in many MXDs generate reports that lists document information data sources, broken layers, spatial reference info, etc. Automate the exporting and printing of map documents Automate map production and create map books extend Data Driven Pages capabilities

Who is arcpy.mapping for? Why was it built? An easy to use, productive scripting environment for the GIS Analyst courser grained object model not a complete replacement for ArcObjects An environment to use for basic map/layer management and map automation tasks A simple way to publish mapping tasks to the server environment arcpy.mapping scripts can be easily published as geoprocessing tools

Demonstration: Brief introduction to arcpy.mapping sample script tools Samples available on the Resource Center: http://esriurl.com/4622

Tour of arcpy.mapping Overview arcpy da ga sa mapping

Tour of arcpy.mapping (cont.) Managing Documents and Layers CLASSES MapDocument Layer/Time TableView LabelClass DataFrame/Time StyleItems GraphicElement LegendElement PictureElement TextElement MapSurroundElement GraduatedColorSym UniqueValueSym ... FUNCTIONS MapDocument Layer ListBrokenDataSources ListDataFrames ListLayers ListLayoutElements ListTableViews AddLayer AddLayerToGroup InsertLayer MoveLayer RemoveLayer UpdateLayer CreateMapSDDraft ...

Tour of arcpy.mapping (cont.) Printing, Exporting, Server Publishing, Map Books CLASSES DataDrivenPages PDFDocument FUNCTIONS ExportReport ExportToAI ExportToBMP ExportToEPS ExportToGIF ExportToJPEG ExportToPDF ExportToPNG ExportToSVG ExportToTIFF PDFDocumentCreate PDFDocumentOpen PrintMap PublishMSDToServer ...

Python Window Command Line becomes the Python Window Quick and easy access to Python and arcpy Gateway for new users to learn Python Intellisense for all tools, methods and properties & help window Quickly and efficiently execute tools

arcpy.mapping 10.1 help Go to Geoprocessing  ArcPy  Mapping module

Demonstration The Python Window and using the Desktop Help System

arcpy.mapping for Map Documents MapDocument function MapDocument Class MapDocument Methods save saveAsCopy UpdateDataSources ... Properties: author credits

Referencing Map Documents (MXDs) Opening Map Documents (MXD) with arcpy.mapping Use the arcpy.mapping.MapDocument function Takes a path to MXD file on disk or special keyword "CURRENT“ Reference map on disk mxd = arcpy.mapping.MapDocument(r"C:\some.mxd") Get map from current ArcMap session mxd = arcpy.mapping.MapDocument("CURRENT")

Referencing Map Documents (MXDs), cont. When using CURRENT Always run in foreground (checkbox in script tool properties) Be wary of open conflicts, file contention May need to refresh the application arcpy.RefreshActiveView() arcpy.RefreshTOC() Limitations and pre-authoring No "New Map" function, so keep an empty MXD available Can’t create new objects (e.g., north arrow, data frame)

Demonstration: Working with Map Documents (MXDs) Use Python Window to change map document property info Evaluate relative paths, last saved, etc. Change the active view Save changes out to a new file

arcpy.mapping for Map Layers and Data Frames The “List” functions ListLayers ListDataFrames Watch the list indexes (you may often forget to use [0]) df = arcpy.mapping.ListDataFrames(MXD)[0] Layer properties Common properties are available (e.g., def query, visible) All properties can be updated via layer (.lyr) files DataFrame properties and methods Map Navigation DataFrameTime

arcpy.mapping for Map Layers and Data Frames Layer functions Data Frame Class Layer ListLayers ListTableViews AddLayer AddLayerToGroup InsertLayer MoveLayer RemoveLayer UpdateLayer Methods panToExtent(extent) zoomToSelectedFeatures() Properties: credits description displayUnits elementHeight elementPositionX ...

Demonstration: Working with Map Layers and Data Frames Find a layer and turns it on or off Modify the scale/rotation of a data frame Zoom to selected features

arcpy.mapping for the Page Layout When and what to pre-author for layout manipulation scenarios Name your layout elements Set the appropriate anchor Cannot add new elements, so pre-author and hide

Demonstration: Working with layout elements Find a picture element and change its data source Find and replace text in an ArcMap layout

arcpy.mapping for Printing and Exporting PDFDocument and DataDrivenPages classes Export and print functions Map server publishing Map book generation FUNCTIONS ExportToAI ExportToBMP ExportToEMF ExportToEPS ExportToGIF ExportToJPEG ExportToPDF ExportToPNG ExportToSVG ExportToTIFF PDFDocumentCreate PDFDocumentOpen PrintMap PublishMSDToServer ... CLASSES DataDrivenPages PDFDocument

Demonstration: Map output and map books Map book that includes index pages using Python ReportLab Sample: http://esriurl.com/4629 Custom thematic map application ported from AML

Updating Data Sources Use arcpy.mapping for migrating Map Documents and Layer files to new data sources Fancier scripts can help mitigate migration pain: SQL syntax changes, field name changes, etc A complete concept document is dedicated to this topic “Updating and fixing data sources with arcpy.mapping” http://esriurl.com/4628 Many capabilities: Update all layers in an MXD or specific tables and layers Works with all file and GDB types Update joins and relates Migrate from different workspace types

arcpy.mapping on the Server Desktop Server Script Tool Python Window Geoprocessing Service Standalone Script: IDE, Command Line, Scheduled Task

Demonstration: arcpy.mapping on ArcGIS Server Exporting a Map Layout to PDF from the server Samples: http://esriurl.com/4627

Resources available ArcGIS Resource Center (web help) http://esriurl.com/4623 Alphabetical lists of classes and functions Detailed discussions Multiple sample scripts for each class and function topic ArcGIS Resource Center (forums) Map Automation: http://esriurl.com/4624 Python: http://esriurl.com/4625 ArcGIS Online – arcpy.mapping / Map Automation group http://esriurl.com/4626 Download sample scripts

Related sessions Wednesday 10:15-11:30 – Building Map Books (Room 6F) Thursday 8:30-9:45 – Geoprocessing with ArcGIS for Server (Room 9) 8:30-9:45 – Supporting High-Quality Printing in Web Applications for ArcGIS 10.1 for Server (Room 7) 10:15-11:30 – Beyond the Basics of arcpy.mapping (Room 7A/B) 3:15-4:30 – Building Map Books (Room 8)

Thank you for attending Have fun at UC2012 Open for Questions Please fill out the evaluation: www.esri.com/ucsessionsurveys First Offering ID: 697 Second Offering ID: 1795