High quality printing using arcpy.mapping

2792
2
03-18-2014 11:27 AM
DavidHaines
Occasional Contributor
I'm wondering 1) if anyone has done this, and 2) if it is even possible?

For a long time, I've wanted to print high-quality / high-resolution maps from AGX.  I've always been limited to just taking a "screenshot" (using disp.GetBitmap(); )  of the display screen and then adding the rest of the layout element to the output.  This is fine for 8.5x11", but anything else it's not.

I think it might be possible to use arcpy.mapping to do this.  Specifically the ConvertWebMapToMapDocument() function.   This would require being connected toArcGIS Server and all of the layers on the screen would need to be map services, which isn't a problem in my case.  Here's what would need to be done.

Create a GeoProcessing tool (the GP tool) on AGS utilizing the ConvertWebMapToMapDocument().  AGX would call the GP tool just like any other GP tool.

To prepare the info needed for the GP tool is the hard part.  The web map api's already have the PrintTask which construct the ExportWebMap JSON which is needed for the GP tool.  AGX has no such function.  As I see it, there are two ways to create the ExportWebMap JSON in AGX.

The "easy?" way.  Read through your layers and basemap, from the layers and basemap, and build a web map in the background using one of the web map api's (silverlight would make the most sense?).  Any graphics would also have to be added to the web map.  Then call the PrintTask to build the JSON.

The "hard" way.  Read through your layers, graphics and basemap and create the ExportWebMap JSON from scratch on your own.

Thoughts?
0 Kudos
2 Replies
NormanDeschamps
New Contributor III
Hey,

I've run into the same limitations with printing. My solution was to write an addin that calculates the size of the area you want printed, the number of pages and size of pages to be printed on, and then uses the getbitmap function and dynamically shifts the view and scale to cover the desired area at the appropriate scale, taking multiple images to fill the entire available page area.

It's not a great solution, in that it does not give a high resolution print; you get 96 dpi (or whatever your screen resolution is) printouts and that's it. However, the nice thing with the add in is that you get 96 dpi regardless of the size of paper or the size of area to be drawn, so you can make a larger map covering a larger number of pages (or larger page size) that is still at least 96 DPI. 

If you are interested, I can post the addin. It's still in kind of the alpha/beta stage but its been working on a few different systems with a couple of different printer types with no issues.

Norman
0 Kudos
DavidHaines
Occasional Contributor
Thanks!  I haven't thought of that before.  That would definitely be a solution for large size plots.
0 Kudos