Select to view content in your preferred language

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

1376
2
07-25-2012 09:16 PM
ScottSugden
Deactivated User
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 W...

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.
0 Kudos
2 Replies
JianHuang
Deactivated User
"layers" property is for dynamic layers, not for controlling to exclude/include sub layers in the printout. In short, if there is no dynamic layers in the map, "layers" shouldn't be used.
For more information about dynamic layers, please visit:
http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi_start.htm#jsapi/dynamiclayerinfo.htm
0 Kudos
ScottSugden
Deactivated User
Hi Jian,

Thank you for the feedback.

But if dynamic layers are enabled for that map service can I not use "layers" to exclude/include sub layers in the printout? If not, for those layers in the map service that have labels how I am to exclude/include labels per layer based on the client side settings in the printout?

Thanks
0 Kudos