Printing & Web Mapping Applications (Dev Meet Up II)
Printing & Web MappingApplicationsMark DonnellyProfessional Services ConsultantEsri Australia
Why Printing?• Most web mapping applications require the ability to print the map area.• There are some special challenges surrounding printing the contents of the map area from a browser.• ArcGIS Server 10.1 has just arrived and promises to make developers lives easier.
What are the challenges? - Browsers arent very good at printing the map area. - The problem is that browsers don’t deal very well with images overlayed on top of each other. - Each browser (IE, Firefox, Chrome) deal with this problem in different ways. See this web map:
This is how the different browsers handle printing the web map:IE Firefox Chrome
What are your options? • To be sure all browsers will display the map area faithfully, we must give it just one image to print. • This can be done in at least two ways: - Write some code that sits on the server, exports each map service to get the various images and then creates a composite image, which is returned to the browser for printing. - Write some client side code that does more or less the same thing. I recently used a HTML canvas object emulator called FXCanvas to do just this.
More Options • As of ArcGIS 10 it has been possible to create large format, high resolution print layouts using Python scripting and the arcpy libraries. • Very recently ArcGIS Server 10.1 was released and it provides out of the box printing functionality via its printing service.
The Printing Service • Is available already installed under the Utilities folder of the ArcGIS Server. It is simply a published geoprocessing service for the Export Web Map Task tool. • Looking at the REST endpoint we can see there is the Export Web Map Task endpoint and it accepts the following parameters:
What if I Want to Use My Own Layouts? • The out of the box print service uses a predefined set of 8 layouts. To nominate different print layouts you need to create your own print service. • Corresponding to the REST endpoint, there is a new tool called Export Web Map which allows the user to define which directory is holding the desired layouts. • You simply publish this tool, defaulting the layout folder directory path to the required location. • This published tool can be consumed by the print task widget as it has the same parameters as the REST endpoint.
Can I Print High Res, Large Format Maps? • Yes this is possible but not with the printing service. The printing service is restricted to 8 predefined layouts, the largest of which is 279 X 432 mm (11 X 17”) (tabloid). • It can be done with the arcpy Python libraries. • Create and publish a Python tool that exports the web map area to an MXD and then use the MXD printing tools to create high res, large format maps. • Available from ArcGIS 10.