0

I want to implement a sort of content negotiation so as to export my map in formats like pdf jpg etc.

Is there any way to export my current map view (with all the enabled options so far) in various formats? With the term current map view i mean "what the end user sees at a specific moment".

My map is generated by combining map Services from different web servers in the Web.

As a result an option such as combining my services in arcMap, publish my map as a MapService and use the export capability provided cannot help: Ex. http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/export?bbox=-241.20512466608835,-27.80850864596666,51.688012394341115,67.48206676752923

I want to get the data live directly from the servers.

In fact would like to use a function like myMap.export("format") where myMap is the current map object shown by my browser.

1

I think this sample should put you on the right track. https://developers.arcgis.com/javascript/jssamples/widget_print_esri_request.html
It shows you how to print the map at various scales and it uses the PrintTemplate "format" option. In the sample, they are using PDF but you have other options (pdf | png32 | png8 | jpg | gif | eps | svg | svgz). See the PrintTemplate and format parts of the API.

var plate = new PrintTemplate();
        plate.layout = plate.label = ch;
        plate.format = "PDF";

Edit: The sample shows a method for downloading the image. I successfully downloaded pdf and png images by switching the "image format" between the two and setting the "format" to "image".

  • But would you be able in that case to download the template (var plate) which is created client side? – Smalis Sep 9 '14 at 8:05
  • Yes the sample shows this. I'll edit my answer to indicate this. – jbchurchill Sep 9 '14 at 14:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.