printing & web mapping applications (dev meet up ii)

13
Printing & Web Mapping Applications Mark Donnelly Professional Services Consultant Esri Australia

Upload: jhasthorpe

Post on 25-Jun-2015

731 views

Category:

Technology


3 download

DESCRIPTION

Esri Australia Dev Meet Up 27/09/12. Presentation from Mark Donnelly

TRANSCRIPT

Page 1: Printing & Web Mapping Applications (Dev Meet Up II)

Printing & Web Mapping ApplicationsMark Donnelly

Professional Services Consultant

Esri Australia

Page 2: Printing & Web Mapping Applications (Dev Meet Up II)

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.

Page 3: Printing & Web Mapping Applications (Dev Meet Up II)

What are the challenges?

- Browsers aren't 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:

Page 4: Printing & Web Mapping Applications (Dev Meet Up II)

IE

Firefox

Chrome

This is how the different browsers handle printing the web map:

Page 5: Printing & Web Mapping Applications (Dev Meet Up II)

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.

Page 6: Printing & Web Mapping Applications (Dev Meet Up II)

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.

Page 7: Printing & Web Mapping Applications (Dev Meet Up II)

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:

Page 8: Printing & Web Mapping Applications (Dev Meet Up II)
Page 9: Printing & Web Mapping Applications (Dev Meet Up II)

How Do I Use It?

• The best way to access the print service is via the ArcGIS APIs (JavaScript, Flex, Silverlight).

• I’ll demo an app for you now that consumes a number of map services, allows the user to draw graphics and provides a drop down list of the available layouts.

Page 10: Printing & Web Mapping Applications (Dev Meet Up II)

What Does the Code Look Like?

Page 11: Printing & Web Mapping Applications (Dev Meet Up II)

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.

Page 12: Printing & Web Mapping Applications (Dev Meet Up II)

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.

Page 13: Printing & Web Mapping Applications (Dev Meet Up II)

Questions?