Is It Possible to Symbolize Layers and Export Images Without ArcMap?

1190
7
02-22-2017 07:49 AM
LloydBronn
Occasional Contributor II

My company generates daily PowerPoint reports from images exported from an MXD. I'm working on turning this workflow into a Python script geoprocessing service that can be triggered from our website. I will generate the PDF report in Python with Reportlab. We don't have ArcMap installed on our ArcGIS server machine, so I'm trying to figure out how we will symbolize our raster layers and export these as images without ArcMap. Is it possible to access an MXD on a workstation over our network through the server using Arcpy? Or should I publish the symbolized layers as a geodata service or map service? The rasters are global, but they will be extracted by country for the reports. 

0 Kudos
7 Replies
JonathanQuinn
Esri Notable Contributor

You'll need to run the script anywhere where ArcMap or ArcGIS Server is installed.  It sounds like the best approach you can use is use a custom form of the printing tools or even write your own.  Essentially you'll be writing a script that will export a map, publish it as a GP service, and then run the GP service from your web site.  Traditionally, printing tools take in a webmap as JSON, but in your case, you can probably hard code a map document, (or provide a list of them, not sure what the use case will be), run the Export to PDF tool, and then return the result to the website.

0 Kudos
LloydBronn
Occasional Contributor II

I think printing tools might be the way to go. Most of the layers I need are already a map service. Is it possible to set a custom output size for the images? For example, I need to extract just Brazil from two global rasters and export two images that will fit on a single page in the PDF report. 

0 Kudos
JonathanQuinn
Esri Notable Contributor

Do you mean the output PDF, or the images/data frames within your map document?  You can interact with any of the elements of a layout using arcpy.mapping.  For example, you can set the width height and position of data frames, change where picture elements go, etc.  You may want to consider creating a web application with your services, adding a print service to it, and then embedding the web application within your website.  Then, you can zoom around your map and select which area to print, and the map will be sent to the print task as JSON and you'll receive your PDF.

0 Kudos
LloydBronn
Occasional Contributor II

The web application will work like this: a user will click on any country in the map. The user will then click on a Python script GP tool link in a popup.The script will create charts for a set number of lat/lon points in the country. We already have a GP service that does that, so we will modify it to run inside this new script. It will then extract the chosen country from global rasters and export these images to an interim folder on our server. These rasters are already published in another map service. The charts and images will then be combined into a PDF report using Reportlab. This report will then be returned to the user in a hyperlink in a popup. I want it to be totally automated. The image view will be based on the country mask, not a user selected area. 

0 Kudos
FC_Basson
MVP Regular Contributor

It sounds like you could actually generate all the maps beforehand with Data Driven Pages and the just let the user download the one for the selected country.

0 Kudos
LloydBronn
Occasional Contributor II

The images won't be for user download, they'll be placed in a PDF report that's returned to the user.

0 Kudos
JonathanQuinn
Esri Notable Contributor

It sounds like his suggestion is to have pre-created PDF files that can be retrieved on disk instead of generating them on the fly.  From your description, it sounds like that may work.

0 Kudos