<?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 Re: MapImageLayer, 100s of not-visible sublayers in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/mapimagelayer-100s-of-not-visible-sublayers/m-p/759827#M70392</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ignore all this nonsense, the dynamic building of the MapImageLayers were passing in an empty array to baselayers if none were to be displayed which was clearing it!&lt;BR /&gt;&lt;BR /&gt;Sorry!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 27 Feb 2019 13:22:40 GMT</pubDate>
    <dc:creator>TonyCollins</dc:creator>
    <dc:date>2019-02-27T13:22:40Z</dc:date>
    <item>
      <title>MapImageLayer, 100s of not-visible sublayers</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/mapimagelayer-100s-of-not-visible-sublayers/m-p/759825#M70390</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We are in the process of re-writing a large internal web application that has 100's of users a day. I originally wrote this many years back using v3 (flex) and it is still functioning perfectly today.&amp;nbsp;We are now in the process of a re-write using VueJS and so I am slowly getting intimate with the documentation for v4 but I am unfortunately not finding everything I need.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Onto my question: &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We are loading in many MapImageLayers, some with 100's of layers/sublayers. Each of these MapServices have every single sublayer with a default visibility of false so that a user can fire up a LayerList/TOC component and switch them on or off.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The issue, which is probably due to my poor understanding, is that these sublayers do not exist in&amp;nbsp;&lt;/P&gt;&lt;P&gt;mapImageLayer.subLayers.items unless I explicitly define them in the constructor&amp;nbsp;with a visibility of false. I assume this is where findSubLayerById() looks?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Obviously I am unable to know these layer id's up-front so am I missing something obvious on how to add these sublayers correctly without having to specify them?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can see all the sublayers&amp;nbsp; in&amp;nbsp;&lt;SPAN&gt;mapImageLayer.serviceSublayers but I&amp;nbsp;have not been able to find this property documented so wonder if I should not be touching it?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for any help&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tony&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Feb 2019 11:16:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/mapimagelayer-100s-of-not-visible-sublayers/m-p/759825#M70390</guid>
      <dc:creator>TonyCollins</dc:creator>
      <dc:date>2019-02-26T11:16:44Z</dc:date>
    </item>
    <item>
      <title>Re: MapImageLayer, 100s of not-visible sublayers</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/mapimagelayer-100s-of-not-visible-sublayers/m-p/759826#M70391</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, I think I have worked it out but I will leave this here in case I am doing something bad or someone else hits the issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It looks like I need to reset sublayers by cloning the service's sublayers. &lt;BR /&gt;There is a method called mapImageLayer.createServiceSubLayers documented here:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-MapImageLayer.html#createServiceSublayers" title="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-MapImageLayer.html#createServiceSublayers"&gt;MapImageLayer | API Reference | ArcGIS API for JavaScript 4.10&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Feb 2019 11:49:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/mapimagelayer-100s-of-not-visible-sublayers/m-p/759826#M70391</guid>
      <dc:creator>TonyCollins</dc:creator>
      <dc:date>2019-02-26T11:49:06Z</dc:date>
    </item>
    <item>
      <title>Re: MapImageLayer, 100s of not-visible sublayers</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/mapimagelayer-100s-of-not-visible-sublayers/m-p/759827#M70392</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ignore all this nonsense, the dynamic building of the MapImageLayers were passing in an empty array to baselayers if none were to be displayed which was clearing it!&lt;BR /&gt;&lt;BR /&gt;Sorry!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Feb 2019 13:22:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/mapimagelayer-100s-of-not-visible-sublayers/m-p/759827#M70392</guid>
      <dc:creator>TonyCollins</dc:creator>
      <dc:date>2019-02-27T13:22:40Z</dc:date>
    </item>
  </channel>
</rss>

