Select to view content in your preferred language

When export task sends dynamicLayers parameter?

52
0
a week ago
daltvr
by
New Contributor II

Hello,

I have some ambiguities when working with MapImageLayers, sublayers and dynamicLayers. I have map image layer with dynamicLayers support but I don't want use it. I don't want show all layers from map service, so I provide sublayers parameter with desired layers to MapImageLayer with only visibility flag.

But sometimes during export task client sends in export task parameter layers=show:... and sometimes dynamicLayers={...json with defs...}. Same behavior in ESRI sample: https://codepen.io/dalasek/pen/BagPmKQ?editors=1000. See the network tab in Chrome developer tools, click butons in different orders and check behavior of export task request.

Steps: 

1. click to Cities (layers: show:0)
2. click to Highways (layers: show:0,1)
3. click to Railroads (dynamicLayers: [{"id":4,"source":{"type":"mapLayer","mapLayerId":4}}]) ---WHY???
4. click to States (again dynamicLayers...)

        const layer = new MapImageLayer({
          url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer",
          sublayers: [
                        {
              id: 4,
              visible: false,
            },
            {
              id: 2,
              visible: false
            },

            {
              id: 1,
              visible: false
            },
            {
              id: 0,
              visible: false
            }
          ]
        });

 

Question: What is the key of how the parameter layers and dynamicLayers are set based on sublayers defs?

Thanks!

//Dalibor

 

 

0 Kudos
0 Replies