<?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: how to add multiple popups on map in JS sdk v4.x in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-add-multiple-popups-on-map-in-js-sdk-v4-x/m-p/1588474#M86562</link>
    <description>&lt;P&gt;Hi nafizpervez:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; As the code above,the popup only open when it is clicked. Any method to open all the popups of graphics?&lt;/P&gt;</description>
    <pubDate>Mon, 24 Feb 2025 12:25:14 GMT</pubDate>
    <dc:creator>baohuachu7</dc:creator>
    <dc:date>2025-02-24T12:25:14Z</dc:date>
    <item>
      <title>how to add multiple popups on map in JS sdk v4.x</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-add-multiple-popups-on-map-in-js-sdk-v4-x/m-p/1571224#M86294</link>
      <description>&lt;P&gt;I has searched in the community, many guys have this requirements but no answer.&lt;/P&gt;&lt;P&gt;The context is as the screenshot attached.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="baohuachu7_0-1735116462728.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/122403iA19CDB10F2A042F3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="baohuachu7_0-1735116462728.png" alt="baohuachu7_0-1735116462728.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Dec 2024 08:48:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-add-multiple-popups-on-map-in-js-sdk-v4-x/m-p/1571224#M86294</guid>
      <dc:creator>baohuachu7</dc:creator>
      <dc:date>2024-12-25T08:48:05Z</dc:date>
    </item>
    <item>
      <title>Re: how to add multiple popups on map in JS sdk v4.x</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-add-multiple-popups-on-map-in-js-sdk-v4-x/m-p/1588471#M86561</link>
      <description>&lt;P&gt;Typically, you can manage multiple pop-ups by manually setting their content and ensuring they open at different locations.&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;STRONG&gt;Add Multiple Graphic Overlays&lt;BR /&gt;&lt;/STRONG&gt;You need to create Graphic objects, each with its own location and content, and add them to the map. You can then associate each graphic with a pop-up.&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Create a Graphic with Popup Information&lt;BR /&gt;&lt;/STRONG&gt;You can create a Graphic object for each point on the map, with a custom pop-up configuration that will display relevant information when clicked.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;require([
  "esri/Map",
  "esri/views/MapView",
  "esri/Graphic",
  "esri/PopupTemplate",
  "esri/layers/GraphicsLayer"
], function (Map, MapView, Graphic, PopupTemplate, GraphicsLayer) {

  // Create the map
  const map = new Map({
    basemap: "streets-navigation-vector"
  });

  // Create the MapView
  const view = new MapView({
    container: "viewDiv",
    map: map
  });

  // Create a GraphicsLayer to hold the graphics (popups)
  const graphicsLayer = new GraphicsLayer();
  map.add(graphicsLayer);

  // Define a simple popup template for each graphic
  const popupTemplate = new PopupTemplate({
    title: "{name}",
    content: "&amp;lt;b&amp;gt;Value:&amp;lt;/b&amp;gt; {value}"
  });

  // Sample data (could come from a database or API)
  const data = [
    { id: 1, name: "108", value: "36.5", coordinates: [-118.15, 33.76] },
    { id: 2, name: "106.1", value: "33.7", coordinates: [-118.17, 33.77] },
    { id: 3, name: "108.2", value: "35.9", coordinates: [-118.16, 33.75] }
  ];

  // Loop through data and create graphics
  data.forEach((point) =&amp;gt; {
    const pointGraphic = new Graphic({
      geometry: {
        type: "point",  // Create point geometry
        longitude: point.coordinates[0],
        latitude: point.coordinates[1]
      },
      symbol: {
        type: "simple-marker",
        color: "blue",
        size: "8px"
      },
      attributes: {
        name: point.name,
        value: point.value
      },
      popupTemplate: popupTemplate // Apply the popup template
    });

    // Add the graphic to the graphics layer
    graphicsLayer.add(pointGraphic);
  });

  // Optional: Set view to zoom in to a specific area if needed
  view.goTo({
    center: [-118.16, 33.75],
    zoom: 14
  });
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;Customizing Popup Templates&amp;nbsp;&lt;/STRONG&gt;&lt;BR /&gt;You can further customize the PopupTemplate to include more complex content, such as HTML, images, or dynamic content fetched from a database.&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Mon, 24 Feb 2025 11:39:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-add-multiple-popups-on-map-in-js-sdk-v4-x/m-p/1588471#M86561</guid>
      <dc:creator>nafizpervez</dc:creator>
      <dc:date>2025-02-24T11:39:24Z</dc:date>
    </item>
    <item>
      <title>Re: how to add multiple popups on map in JS sdk v4.x</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-add-multiple-popups-on-map-in-js-sdk-v4-x/m-p/1588474#M86562</link>
      <description>&lt;P&gt;Hi nafizpervez:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; As the code above,the popup only open when it is clicked. Any method to open all the popups of graphics?&lt;/P&gt;</description>
      <pubDate>Mon, 24 Feb 2025 12:25:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-add-multiple-popups-on-map-in-js-sdk-v4-x/m-p/1588474#M86562</guid>
      <dc:creator>baohuachu7</dc:creator>
      <dc:date>2025-02-24T12:25:14Z</dc:date>
    </item>
  </channel>
</rss>

