ScottSugden

Export Web Map Specification - map service layer  - layers array not used

Discussion created by ScottSugden on Jul 25, 2012
Latest reply on Jul 28, 2012 by ScottSugden
Hi,

I am generating json for the Export Web Map Task. The web map contains one operational layer, a map service layer. I can set layer visibility using the visibleLayers array. However, I also need to control if labels are displayed. The layers array is meant to provide this sort of functionality. But when I populate the layers array it is not being used at all. Even if I specify the minimal amount of data for a layer eg {"id":2} it does not work.


The following json exports all layers rather than just layer 2 as specified (see "layers":[{"id":2}]) :

{"mapOptions":{"extent":{"xmin":-119.99765880885,"ymin":35.101642914773109,"xmax":-119.06245925015001,"ymax":35.652787188033635,"spatialReference":{"wkid":4326,"wkt":null}},"scale":524039.9997638216,"rotation":0,"spatialReference":{"wkid":4326,"wkt":null},"time":null},"operationalLayers":[{"id":"Military","url":"http://sampleserver6.arcgisonline.com:80/arcgis/rest/services/Military/MapServer","token":"","title":"Military","visibility":true,"opacity":1,"minScale":0,"maxScale":0,"gdbVersion":null,"visibleLayers":[],"layers":[{"id":2}]}],"baseMap":{"title":null,"baseMapLayers":[]},"exportOptions":{"dpi":null,"outputSize":[750,442]},"layoutOptions":{"titleText":null,"authorText":null,"copyrightText":null,"scaleBarOptions":{"metricUnit":null,"metricLabel":null,"nonMetricUnit":null,"nonMetricLabel":null},"customTextElements":{},"legendOptions":{"operationalLayers":null}}}

The following works, but is uses the the visibleLayers array:

{"mapOptions":{"extent":{"xmin":-119.99765880885,"ymin":35.101642914773109,"xmax":-119.06245925015001,"ymax":35.652787188033635,"spatialReference":{"wkid":4326,"wkt":null}},"scale":524039.9997638216,"rotation":0,"spatialReference":{"wkid":4326,"wkt":null},"time":null},"operationalLayers":[{"id":"Military","url":"http://sampleserver6.arcgisonline.com:80/arcgis/rest/services/Military/MapServer","token":"","title":"Military","visibility":true,"opacity":1,"minScale":0,"maxScale":0,"gdbVersion":null,"visibleLayers":[2],"layers":[]}],"baseMap":{"title":null,"baseMapLayers":[]},"exportOptions":{"dpi":null,"outputSize":[750,442]},"layoutOptions":{"titleText":null,"authorText":null,"copyrightText":null,"scaleBarOptions":{"metricUnit":null,"metricLabel":null,"nonMetricUnit":null,"nonMetricLabel":null},"customTextElements":{},"legendOptions":{"operationalLayers":null}}}

You can test at:
http://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export Web Map Task/execute

Any help/guidance would be appreciated.

Thank you.

PS I forgot to mention that the example map above does not have dynamic layers enabled. However, I have also tested on another site where dynamic layers are enabled and I get the same results.

Outcomes