Select to view content in your preferred language

Print map using layers from multiple map services

2074
10
10-14-2016 09:38 AM
ThomasPuthusserry
New Contributor III

Is it possible to print map layers from multiple map services using ArcGIS Java Script API? I have situation where more than 2 map services needs to be included in a single JavaScript application and layers from any of these services (as selected by the user) needs to be exported as a map using the Export Webmap service (using a defined map template published from my server). However, when using the Export WebMap print service, there is only option to pass one map service as a parameter. Is there any way around?

0 Kudos
10 Replies
JoelBennett
MVP Regular Contributor

Indeed, it is rather strange to see someone generating print output the hard way, and I too would recommend the PrintTask as well, since it will greatly simplify things.

However, to just answer the question as it was presented, yes, you can pass multiple map service definitions to the ExportWebMap service.  The operationalLayers parameter is an array, so by definition accepts any number of values:

{
 "mapOptions": {
  /* etc, etc */
 },
 "operationalLayers": [
  {
   "id": "layer1",
   "url": "http://whatever.com/arcigs/rest/services/service1/MapServer"
  }, {
   "id": "layer2",
   "url": "http://whatever.com/arcigs/rest/services/service2/MapServer"
  }, {
   "id": "layer3",
   "url": "http://someOtherSite.com/arcigs/rest/services/service74/MapServer"
  }
 ],
 "exportOptions": {
  /* etc, etc */
 },
 "layoutOptions": {
  /* etc, etc */
 }
}

The above code just shows the structure...there are many parameters I have not displayed just for simplicity.