<?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: Set Layer Visibility in URL in ArcGIS Web AppBuilder Questions</title>
    <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/set-layer-visibility-in-url/m-p/481721#M12685</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think I found what I need here:&amp;nbsp;&lt;A class="link-titled" href="https://doc.arcgis.com/en/web-appbuilder/manage-apps/app-url-parameters.htm" title="https://doc.arcgis.com/en/web-appbuilder/manage-apps/app-url-parameters.htm"&gt;Use URL parameters—Web AppBuilder for ArcGIS | Documentation&lt;/A&gt;&amp;nbsp;.&lt;/P&gt;&lt;P&gt;I see I can pass in showLayers=&amp;lt;LayerName1&amp;gt;;&amp;lt;LayerName2&amp;gt;. All I need for a numeric lookup is to add in a lookup table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 22 Jan 2020 13:44:47 GMT</pubDate>
    <dc:creator>ChrisSands</dc:creator>
    <dc:date>2020-01-22T13:44:47Z</dc:date>
    <item>
      <title>Set Layer Visibility in URL</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/set-layer-visibility-in-url/m-p/481718#M12682</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a web map with multiple layers served from my local rest map services. I want to build a web app that will allow me to specify in the url which of those layers are on or off.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I understand the default visibility is set in the web map. But the visibility can be changed in the web app with the LayerList widget. I want to change the visibility at load time without the user having to open the LayerList. I know there is an entry point to affecting the layer visibility through code because LayerList does it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to pass in my url http://&amp;lt;path&amp;gt;/?layers=1,2,3&amp;nbsp;so that all layers are turned off except those that match to indexes 1, 2, and 3 in my array of layers. I can take care of a lookup to get the names of these layers. Once I have a reference to the operating layers, I can set the visibility property to true or false for the specified layers. When I step through my code, I can see that the visibility values are changed, but there is no corresponding impact on the map.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think what I am missing are 1) referencing the operating layers correctly (this.operLayerInfos in LayerList/Widget.js); and 2) calling my function from a proper location where it will be invoked when the map loads. Or maybe visibility isn't the right property?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would appreciate any guidance for how/where to add this functionality.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First draft code in attachment.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Jan 2020 17:50:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/set-layer-visibility-in-url/m-p/481718#M12682</guid>
      <dc:creator>ChrisSands</dc:creator>
      <dc:date>2020-01-07T17:50:13Z</dc:date>
    </item>
    <item>
      <title>Re: Set Layer Visibility in URL</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/set-layer-visibility-in-url/m-p/481719#M12683</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Chris,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;You need to work with the jimu.js classes if you want WAB to recognize that you have changed a layers visibility.&lt;/P&gt;&lt;P&gt;Look at the code in the Layer Toggle Button widget. It uses the Jimu &lt;A href="https://developers.arcgis.com/web-appbuilder/api-reference/layerstructure.htm"&gt;LayerStructure&lt;/A&gt; class to get the layer objects in the webmap.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/docs/DOC-8592"&gt;Layer Toggle Button Widget Version 2.12 - 08/28/2019&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Jan 2020 23:44:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/set-layer-visibility-in-url/m-p/481719#M12683</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2020-01-07T23:44:05Z</dc:date>
    </item>
    <item>
      <title>Re: Set Layer Visibility in URL</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/set-layer-visibility-in-url/m-p/481720#M12684</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you. This looks like a good starting point. I will have to work with it a bit. I will report back when I have progress or ask other questions if I get stuck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Jan 2020 15:00:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/set-layer-visibility-in-url/m-p/481720#M12684</guid>
      <dc:creator>ChrisSands</dc:creator>
      <dc:date>2020-01-10T15:00:41Z</dc:date>
    </item>
    <item>
      <title>Re: Set Layer Visibility in URL</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/set-layer-visibility-in-url/m-p/481721#M12685</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think I found what I need here:&amp;nbsp;&lt;A class="link-titled" href="https://doc.arcgis.com/en/web-appbuilder/manage-apps/app-url-parameters.htm" title="https://doc.arcgis.com/en/web-appbuilder/manage-apps/app-url-parameters.htm"&gt;Use URL parameters—Web AppBuilder for ArcGIS | Documentation&lt;/A&gt;&amp;nbsp;.&lt;/P&gt;&lt;P&gt;I see I can pass in showLayers=&amp;lt;LayerName1&amp;gt;;&amp;lt;LayerName2&amp;gt;. All I need for a numeric lookup is to add in a lookup table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jan 2020 13:44:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/set-layer-visibility-in-url/m-p/481721#M12685</guid>
      <dc:creator>ChrisSands</dc:creator>
      <dc:date>2020-01-22T13:44:47Z</dc:date>
    </item>
  </channel>
</rss>

