<?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 Multiple WebMap Instances with Map Components in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/multiple-webmap-instances-with-map-components/m-p/1605707#M86927</link>
    <description>&lt;P&gt;How would I convert &lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/webmap-swap/" target="_self"&gt;this sample&lt;/A&gt; to map components? I have an &lt;A href="https://webapp.willcountyillinois.com/lidarviewer.html" target="_self"&gt;existing app&lt;/A&gt; that combines that sample with a swipe widget. And I'm attempting to update it. I've gotten as far as utilizing the arcgis-swipe component, but I'm stuck on how to implement more than one webmap.&lt;/P&gt;</description>
    <pubDate>Mon, 14 Apr 2025 16:39:31 GMT</pubDate>
    <dc:creator>JaredPilbeam2</dc:creator>
    <dc:date>2025-04-14T16:39:31Z</dc:date>
    <item>
      <title>Multiple WebMap Instances with Map Components</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/multiple-webmap-instances-with-map-components/m-p/1605707#M86927</link>
      <description>&lt;P&gt;How would I convert &lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/webmap-swap/" target="_self"&gt;this sample&lt;/A&gt; to map components? I have an &lt;A href="https://webapp.willcountyillinois.com/lidarviewer.html" target="_self"&gt;existing app&lt;/A&gt; that combines that sample with a swipe widget. And I'm attempting to update it. I've gotten as far as utilizing the arcgis-swipe component, but I'm stuck on how to implement more than one webmap.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Apr 2025 16:39:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/multiple-webmap-instances-with-map-components/m-p/1605707#M86927</guid>
      <dc:creator>JaredPilbeam2</dc:creator>
      <dc:date>2025-04-14T16:39:31Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple WebMap Instances with Map Components</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/multiple-webmap-instances-with-map-components/m-p/1605722#M86929</link>
      <description>&lt;P&gt;Good question! I've been wanting to update this one to show it.&lt;/P&gt;&lt;P&gt;You can do one of two things, depending on what you need. You can create the webmaps ahead of time and set the `element.map = myMap` property or set the `element.itemId = myItemid` property.&lt;/P&gt;&lt;P&gt;Here is a demo using the itemId&lt;/P&gt;&lt;P&gt;&lt;A href="https://codepen.io/odoe/pen/raaByOg?editors=1000" target="_blank"&gt;https://codepen.io/odoe/pen/raaByOg?editors=1000&lt;/A&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;body&amp;gt;
  &amp;lt;div id="container"&amp;gt;
    &amp;lt;section class="header esri-widget"&amp;gt;
      &amp;lt;div class="btns"&amp;gt;
        &amp;lt;div class="btn-switch active-map" data-id="0"&amp;gt;Missing Migrants&amp;lt;/div&amp;gt;
        &amp;lt;div class="btn-switch" data-id="1"&amp;gt;Refugee Routes&amp;lt;/div&amp;gt;
        &amp;lt;div class="btn-switch" data-id="2"&amp;gt;2015 European Sea Arrivals&amp;lt;/div&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/section&amp;gt;
    &amp;lt;arcgis-map&amp;gt;
    &amp;lt;/arcgis-map&amp;gt;
  &amp;lt;/div&amp;gt;
  &amp;lt;script type="module"&amp;gt;
    const webmapids = [
      "ad5759bf407c4554b748356ebe1886e5",
      "71ba2a96c368452bb73d54eadbd59faa",
      "45ded9b3e0e145139cc433b503a8f5ab"
    ];
    const mapElement = document.querySelector("arcgis-map");
    mapElement.itemId = webmapids[0];
    document.querySelector(".btns").addEventListener("click", (event) =&amp;gt; {
      const id = event.target.getAttribute("data-id");
      if (id) {
        mapElement.itemId = webmapids[id];
        const nodes = document.querySelectorAll(".btn-switch");
        for (let idx = 0; idx &amp;lt; nodes.length; idx++) {
          const node = nodes[idx];
          const mapIndex = node.getAttribute("data-id");
          if (mapIndex === id) {
            node.classList.add("active-map");
          } else {
            node.classList.remove("active-map");
          }
        }
      }
    });
  &amp;lt;/script&amp;gt;
&amp;lt;/body&amp;gt;&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 14 Apr 2025 17:08:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/multiple-webmap-instances-with-map-components/m-p/1605722#M86929</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2025-04-14T17:08:05Z</dc:date>
    </item>
  </channel>
</rss>

