Esri UC 2014 | Technical Workshop | Python Map Automation – Beyond the Basics of arcpy.mapping Jeff Barrette Jeff Moulds.

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.
ArcGIS Data Reviewer: An Introduction
Esri UC 2014 | Technical Workshop | Leveraging Metadata Standards for Supporting Interoperability in ArcGIS Aleta Vienneau, David Danko.
Technical Workshops | Esri International User Conference San Diego, California Leveraging Metadata Standards in ArcGIS for Interoperability Aleta Vienneau.
Esri UC2013. Technical Workshop. Technical Workshop 2013 Esri International User Conference July 8–12, 2013 | San Diego, California Editing in ArcMap:
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
Esri UC 2014 | Technical Workshop | ArcGIS Data Reviewer Edwin Waite & Shankar Chandrasekaran Planning and Deploying Data Quality Services.
Python Map Automation: Introduction to arcpy.mapping / arcpy.mp
Esri UC 2014 | Demo Theater | Esri Production Mapping: Configuring Business Rules Joseph Sheffield.
Esri UC2013. Technical Workshop. Technical Workshop 2013 Esri International User Conference July 8–12, 2013 | San Diego, California ArcGIS API for Flex.
Esri UC2013. Technical Workshop. Technical Workshop 2013 Esri International User Conference July 8–12, 2013 | San Diego, California Caching Imagery Using.
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
Esri UC 2014 | Demo Theater | Troubleshooting Printing and Exporting from ArcMap Michael Grossman.
Preparing and Deploying Data to ArcPad Juan Luera.
MXD, Maps, Layers arcpy.mapping Classes.
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 UC 2014 | Technical Workshop | Geocoding with ArcGIS Online and ArcGIS Online World Geocoding Service Jeff Rogers and Brad Niemand.
Esri UC2013. Technical Workshop. Technical Workshop 2013 Esri International User Conference July 8–12, 2013 | San Diego, California Geocoding – An Introduction.
Esri UC2013. Technical Workshop. Technical Workshop 2013 Esri International User Conference July 8–12, 2013 | San Diego, California Supporting High-Quality.
Esri UC 2014 | Technical Workshop | Developing Offline Apps with ArcGIS Runtime SDKs Euan Cameron Justin Colville Will Crick.
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 | Data Interoperability: An Introduction Bruce Dale LutzSafe Software.
Esri UC 2014 | Demo Theater | Esri Production Mapping: Spatial Document Management Joseph Sheffield.
Esri UC 2014 | Technical Workshop | Creating Geoprocessing Services Kevin Hibma.
Esri UC 2014 | Technical Workshop | Using ArcGIS Online Analysis Widgets Shing Lin, Jerome Yang.
Desktop Mapping: Building Map Books Jeff Barrette Michael Grossman.
Esri UC 2014 | Demo Theater | Ten ArcMap Tips and Tricks Michael Grossman.
Esri UC 2014 | Technical Workshop | Python: Beyond the Basics David Wynne, Jon Bodamer.
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.
Esri Production Mapping: Configuring Business Rules Joseph Sheffield.
Esri UC 2014 | Technical Workshop | Administering ArcGIS for Server with Python Jon Bodamer.
Esri UC 2014 | Technical Workshop | Migrating Data To The Parcel Fabric Christine Leslie Amir Bar-Maor.
Esri UC 2014 | Technical Workshop | Enhancing Web Map Performance in ArcGIS Online Julia Guard & Melanie Summers.
Jeff Barrette Jeff Moulds
Tech Support Tips and Tricks: ArcGIS for Desktop
Desktop Mapping: Building Map Books
Creating Geoprocessing Services
Geoprocessing with ArcGIS for Server
Python Map Automation – Introduction to arcpy.mapping
Python Map Automation – Beyond the Basics of arcpy.mapping
Learning Common GIS Workflows
Building Map Books in ArcGIS
Best Practices for Designing Effective Map Services: Case Studies
Python Map Automation – Beyond the Basics of arcpy.mapping
Network Analysis using Python
ModelBuilder – Getting Started
Building Map Books in ArcGIS
Designing and Using Cached Map Services
Desktop Mapping: Building Map Books
Presentation transcript:

Esri UC 2014 | Technical Workshop | Python Map Automation – Beyond the Basics of arcpy.mapping Jeff Barrette Jeff Moulds

Esri UC 2014 | 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 (or at least the ones you want to find) 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 Python Map Automation - Beyond the Basics of arcpy.mapping Us You “The Line”

Esri UC 2014 | Technical Workshop | Jeff Barrette Sample Applications

Esri UC 2014 | Technical Workshop | You can clone text and graphic elements This allows you to automate things like dynamic tables 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 Cloning elements Python Map Automation - Beyond the Basics of arcpy.mapping

Esri UC 2014 | Technical Workshop | arcpy.mapping group on ArcGIS Online Python Map Automation - Beyond the Basics of arcpy.mapping

Esri UC 2014 | Technical Workshop | 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

Esri UC 2014 | Technical Workshop | Performance tips (continued) 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!!!"

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

Esri UC 2014 | Technical Workshop | Server printing out-of-the-box ArcGIS Server 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: Related Session: Enabling High-Quality Printing in Web Applications 12pm – 12:30pm General Theater 3 Exhibit Hall A)

Esri UC 2014 | Technical Workshop | Advanced server printing with arcpy.mapping Build web apps with customized versions of the out-of-the-box print service arcpy.mapping method for converting Web Maps to Map Documents: - ConvertWebMapToMapDocument (webmap_json, {template_mxd}, {notes_gdb}, {extra_conversion_options}) Web application High-quality output (e.g. PDF) arcpy.mapping

Esri UC 2014 | Technical Workshop | Advanced server printing with arcpy.mapping Full capabilities of arcpy.mapping on the document - Swap out service layers for local vector data for vector PDF output - Export using advanced options - Export data driven pages - Export to PDF and insert additional pages (title page, reports, etc.) - Controlling the appearance of the legend - Etc. Return a printer-friendly output file (PDF, PNG, etc.) Online help and examples

Esri UC 2014 | Technical Workshop | Demo: Web app to export vector PDF using arcpy.mapping Output or print vector layers instead of “flat” image of service layers  Vector layers will be staged in template map document Map service tiled cache (low dpi) Vector data (or high dpi image) Output PDF viewed in Adobe Reader

Esri UC 2014 | Technical Workshop | Demo: Web app to export vector PDF using arcpy.mapping Reference the custom arcpy.mapping based GP service

Esri UC 2014 | Technical Workshop | 1 Demo: Web app to export vector PDF using arcpy.mapping Python code used in custom GP service Get web map JSON Export PDF Create new MXD based on web map Get template MXD Remove service layers Output file of job

Esri UC 2014 | Technical Workshop | Web app to export vector PDF using arcpy.mapping Two tutorials in the help: - Basic vector web map printing: - Advanced web map printing: Georeferencing Layers in map Output format Layers in legend List Comprehension

Esri UC 2014 | Technical Workshop | Advanced Server Printing Modify arcpy.mapping scripts authored on Desktop and use them in geoprocesing and print services

Esri UC 2014 | Technical Workshop | Advanced Server Printing: new function at 10.3 Layer.UpdateLayerFromJSON(json_layer_definition) - Used in web map printing applications that support changing the renderer (or other properties) of dynamic web service layers. - Will apply the renderer (or other layer properties) as specified in the webmap_json to the corresponding vector layers staged in the template map document. Get JSON Layer Definition from web map Update vector layer from JSON

Esri UC 2014 | Technical Workshop | Publishing map services with arcpy.mapping arcpy.mapping.CreateMapSDDraft(map_document, out_sddraft, service_name, {server_type}, {connection_file_path}, {copy_data_to_server}, {folder_name}, {summary}, {tags}) Workflow to convert map document to map service. Use python scripts for: - Scheduled service updates. E.g. nightly. - Publishing automated analysis results. - Batch publishing. Create SDDraft file (and optionally edit XML) arcpy.mapping.CreateMapSDDraft() Reference & prepare MXDs arcpy.mapping.MapDocument() Stage and Publish Map Service (arcpy server GP tools) arcpy.StageService_server() arcpy.UploadServiceDefinition_server()

Esri UC 2014 | Technical Workshop | Publishing map services with arcpy.mapping Sample script: CreateMapSDDraft Reference MXD Stage and publish Map Service Create and analyze sddraft for errors, warnings, etc. Online help and samples: Server connection, service properties, etc. Don’t publish if errors exist

Esri UC 2014 | Technical Workshop | Publishing other service types with python - Create geoprocessing services - arcpy.CreateGPSDDraft() - Create image services - arcpy.CreateImageSDDraft() - Create geocoding services - arcpy.CreateGeocodeSDDraft()

Esri UC 2014 | Technical Workshop | Migrating to ArcGIS Pro Help Topic: Migrating arcpy.mapping from ArcMap to ArcGIS Pro - Python ArcGIS project file (.aprx) - Stand-alone functions have moved to appropriate classes - mapFrame.exportToPDF() - map.addLayer(), map.insertLayer(), etc - Layer files have changed - DataFrame replaced by Map, MapFrame, and Camera - New Layout object - Application always refreshes when using CURRENT

Esri UC 2014 | Technical Workshop | Please fill out the session evaluation First Offering ID: 1307 Second Offering ID: 1405 Online – Paper – pick up and put in drop box Thank you…

Esri UC 2014 | Technical Workshop | Python Map Automation - Beyond the Basics of arcpy.mapping