Python Map Automation – Beyond the Basics of arcpy.mapping

Slides:



Advertisements
Similar presentations
Publishing GIS Services to ArcGIS for Server
Advertisements

Esri UC 2014 | Technical Workshop | Automating Cache Workflows and Tile Usage Heat Maps Eric J. Rodenberg.
Esri UC 2014 | Technical Workshop | Performing Advanced Cartography with Esri Production Mapping Clint Loveman & Madhura Phaterpekar.
Technical Workshops | Esri International User Conference San Diego, California Leveraging Metadata Standards in ArcGIS for Interoperability Aleta Vienneau.
Esri International User Conference | San Diego, CA Technical Workshops | ArcGIS for SharePoint, An Introduction Art Haddad Rich Zwaap.
Esri UC2013. Technical Workshop.Editing & Maintaining Parcels with ArcGIS.
Esri UC2013. Technical Workshop. Technical Workshop 2013 Esri International User Conference July 8–12, 2013 | San Diego, California Editing in ArcMap:
Sharing imagery and raster data in ArcGIS
Sharing Geographic Content
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,
Esri UC 2014 | Technical Workshop | Accessing Spatial Databases in ArcGIS using Query Layers Annie Sasidar.
1/36. 2/36 Something cool …
Esri International User Conference | San Diego, CA Technical Workshops | ArcGIS ArcMap: Printing, Exporting, and ArcPress Michael Grossman Jeremy Wright.
Network Analysis with Python
Python: An Introduction
Python Map Automation: Introduction to arcpy.mapping / arcpy.mp
Esri UC2013. Technical Workshop. Technical Workshop 2013 Esri International User Conference July 8–12, 2013 | San Diego, California ArcGIS API for Flex.
Publishing to ArcGIS for Server
Enabling High-Quality Printing in Web Applications
Esri UC2013. Technical Workshop. Technical Workshop 2013 Esri International User Conference July 8–12, 2013 | San Diego, California Road Ahead - ArcGIS.
ArcGIS Pro: Mapping and Visualization Craig Williams, Edie Punt, &
Advance Map Automation With Python
Esri Defense Mapping: Cartographic Production
Preparing and Deploying Data to ArcPad Juan Luera.
ArcGIS Server for Administrators
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.
Esri UC 2014 | Technical Workshop | Designing and Using Cached Map Services Tom Brenneman & Eric Rodenberg.
Esri UC2013. Technical Workshop. Technical Workshop 2013 Esri International User Conference July 8–12, 2013 | San Diego, California Geodatabase Administration:
Esri UC 2014 | Technical Workshop | Geocoding with ArcGIS Online and ArcGIS Online World Geocoding Service Jeff Rogers and Brad Niemand.
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 Automating Geodatabase.
Esri UC 2014 | Technical Workshop | Creating Geoprocessing Services Kevin Hibma.
Esri UC2013. Technical Workshop. Technical Workshop 2013 Esri International User Conference July 8–12, 2013 | San Diego, California Migrating Parcel data.
Desktop Mapping: Building Map Books Jeff Barrette Michael Grossman.
Developing Cross Platform Apps with the ArcGIS Runtime SDK for Qt
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 | ArcGIS API for JavaScript: An Introduction Kelly Hutchins Derek Swingley.
Esri UC 2014 | Technical Workshop | Editing in ArcMap: An Introduction Lisa Stanners, Phil Sanchez.
ArcGIS Workflow Manager: Integrating Geoprocessing into Your Business Processes Nishi Mishra.
Esri UC2013. Technical Workshop. Technical Workshop 2013 Esri International User Conference July 8–12, 2013 | San Diego, California Working with Metadata.
Technical Workshops | Esri International User Conference San Diego, California Branching and Iteration in ModelBuilder Shitij Mehta July 24, :15.
Esri UC 2014 | Technical Workshop | Administering ArcGIS for Server with Python Jon Bodamer.
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
Collector: Authoring Maps for Offline Data Collection
PYTHON: AN INTRODUCTION
ArcGIS for Server: What’s New
Geoprocessing with ArcGIS for Server
Python Map Automation – Introduction to arcpy.mapping
Learning Common GIS Workflows
Building Map Books in ArcGIS
ArcGIS Workflow Manager: Using Custom Properties to Automate Workflows
Best Practices for Designing Effective Map Services: Case Studies
Python Map Automation – Beyond the Basics of arcpy.mapping
ModelBuilder – Getting Started
Building Map Books in ArcGIS
Network Analyst – Automating Workflows with Geoprocessing
Python – Beyond the Basics
ModelBuilder – Getting Started
Desktop Mapping: Building Map Books
Presentation transcript:

Python Map Automation – Beyond the Basics of arcpy.mapping 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

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” Python Map Automation – Beyond the Basics of arcpy.mapping

Sample Application Jeff Barrette http://esriurl.com/5907 DEMO 1 DEMO 2

What’s new topic http://esriurl.com/4597 What’s new  Mapping  What’s new for automating map workflows Python Map Automation – Beyond the Basics of arcpy.mapping

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 DEMO Python Map Automation – Beyond the Basics of arcpy.mapping

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 DEMO1 DEMO2 Python Map Automation – Beyond the Basics of arcpy.mapping

arcpy.mapping group http://esriurl.com/5915 Python Map Automation – Beyond the Basics of arcpy.mapping

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 Python Map Automation – Beyond the Basics of arcpy.mapping

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!!!" Python Map Automation – Beyond the Basics of arcpy.mapping

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 path = arcpy.env.scratchWorkspace             ... arcpy.SetParameterAsText(1,path + "\\output.pdf") Python Map Automation – Beyond the Basics of arcpy.mapping

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

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 1 2 Related Session: Supporting High-Quality Printing in Web Applications with ArcGIS for Server (Wednesday @ 8:30 am Room 15A) Python Map Automation – Beyond the Basics of arcpy.mapping

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

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 Python Map Automation – Beyond the Basics of arcpy.mapping

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 Python Map Automation – Beyond the Basics of arcpy.mapping

Demo: High quality server printing with arcpy.mapping Reference the custom arcpy.mapping based GP service Python Map Automation – Beyond the Basics of arcpy.mapping

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

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 Python Map Automation – Beyond the Basics of arcpy.mapping

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 Create SDDraft and edit XML (arcpy.mapping) arcpy.mapping.CreateMapSDDraft() Prepare MXDs arcpy.mapping.MapDocument() Stage and Publish Map Service (arcpy server GP tools) arcpy.StageService_server() arcpy.UploadServiceDefinition_server() Python Map Automation – Beyond the Basics of arcpy.mapping

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 Python Map Automation – Beyond the Basics of arcpy.mapping

Publishing other service types with python 10.1: arcpy.CreateMapSDDraft() 10.1 sp1: arcpy.CreateGPSDDraft() Create geoprocessing services with Python arcpy.CreateImageSDDraft() Create image services with Python 10.2: arcpy.CreateGeocodeSDDraft() Create geocoding services with Python Python Map Automation – Beyond the Basics of arcpy.mapping

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 Building Map Books in ArcGIS

Thank you… First Offering ID: 1298 Second Offering ID: 1220 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