<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic When export task sends dynamicLayers parameter? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/when-export-task-sends-dynamiclayers-parameter/m-p/1529074#M85516</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have some&amp;nbsp;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 &lt;STRONG&gt;with only visibility flag&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;But sometimes during export task client sends in export task parameter &lt;FONT face="courier new,courier"&gt;layers=show:...&lt;/FONT&gt; and sometimes &lt;FONT face="courier new,courier"&gt;dynamicLayers={...json with defs...}&lt;/FONT&gt;. Same behavior in ESRI sample:&amp;nbsp;&lt;A href="https://codepen.io/dalasek/pen/BagPmKQ?editors=1000" target="_blank"&gt;https://codepen.io/dalasek/pen/BagPmKQ?editors=1000&lt;/A&gt;. See the network tab in Chrome developer tools, click butons in different orders and check behavior of export task request.&lt;/P&gt;&lt;P&gt;Steps:&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. click to Cities (layers: show:0)&lt;BR /&gt;2. click to Highways&amp;nbsp;(layers: show:0,1)&lt;BR /&gt;3. click to Railroads (dynamicLayers: [{"id":4,"source":{"type":"mapLayer","mapLayerId":4}}]) &lt;STRONG&gt;---WHY???&lt;/STRONG&gt;&lt;BR /&gt;4. click to States (again dynamicLayers...)&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;        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
            }
          ]
        });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Question: What is the key of how the parameter &lt;STRONG&gt;layers&lt;/STRONG&gt; and &lt;STRONG&gt;dynamicLayers&lt;/STRONG&gt; are set based on sublayers defs?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;//Dalibor&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 28 Aug 2024 22:42:09 GMT</pubDate>
    <dc:creator>daltvr</dc:creator>
    <dc:date>2024-08-28T22:42:09Z</dc:date>
    <item>
      <title>When export task sends dynamicLayers parameter?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/when-export-task-sends-dynamiclayers-parameter/m-p/1529074#M85516</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have some&amp;nbsp;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 &lt;STRONG&gt;with only visibility flag&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;But sometimes during export task client sends in export task parameter &lt;FONT face="courier new,courier"&gt;layers=show:...&lt;/FONT&gt; and sometimes &lt;FONT face="courier new,courier"&gt;dynamicLayers={...json with defs...}&lt;/FONT&gt;. Same behavior in ESRI sample:&amp;nbsp;&lt;A href="https://codepen.io/dalasek/pen/BagPmKQ?editors=1000" target="_blank"&gt;https://codepen.io/dalasek/pen/BagPmKQ?editors=1000&lt;/A&gt;. See the network tab in Chrome developer tools, click butons in different orders and check behavior of export task request.&lt;/P&gt;&lt;P&gt;Steps:&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. click to Cities (layers: show:0)&lt;BR /&gt;2. click to Highways&amp;nbsp;(layers: show:0,1)&lt;BR /&gt;3. click to Railroads (dynamicLayers: [{"id":4,"source":{"type":"mapLayer","mapLayerId":4}}]) &lt;STRONG&gt;---WHY???&lt;/STRONG&gt;&lt;BR /&gt;4. click to States (again dynamicLayers...)&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;        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
            }
          ]
        });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Question: What is the key of how the parameter &lt;STRONG&gt;layers&lt;/STRONG&gt; and &lt;STRONG&gt;dynamicLayers&lt;/STRONG&gt; are set based on sublayers defs?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;//Dalibor&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2024 22:42:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/when-export-task-sends-dynamiclayers-parameter/m-p/1529074#M85516</guid>
      <dc:creator>daltvr</dc:creator>
      <dc:date>2024-08-28T22:42:09Z</dc:date>
    </item>
  </channel>
</rss>

