<?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 do I group multiple graphics layers together and get their geometry? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-group-multiple-graphics-layers-together/m-p/1483778#M84781</link>
    <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/215607"&gt;@Josh-R&lt;/a&gt;&amp;nbsp;What you'll likely want to do is to get all the graphics from the layer attached to the sketchViewModel and then union them together to get a new geometry that is all the graphics combined.&lt;BR /&gt;And then use that to apply the filter.&lt;BR /&gt;&lt;BR /&gt;You can see this in practice in this esri sample.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=highlight-features-by-geometry" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=highlight-features-by-geometry&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Specifically these lines:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;        sketchViewModel.on("create", async (event) =&amp;gt; {
          if (event.state === "complete") {
            // this polygon will be used to query features that intersect it
            const geometries = polygonGraphicsLayer.graphics.map(function (graphic) {
              return graphic.geometry;
            });
            const queryGeometry = await geometryEngineAsync.union(geometries.toArray());
            selectFeatures(queryGeometry);
          }
        });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 04 Jun 2024 00:50:34 GMT</pubDate>
    <dc:creator>JamesIng</dc:creator>
    <dc:date>2024-06-04T00:50:34Z</dc:date>
    <item>
      <title>How do I group multiple graphics layers together and get their geometry?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-group-multiple-graphics-layers-together/m-p/1483457#M84775</link>
      <description>&lt;P&gt;I have a sketch tool (based on this &lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/sketch-viewmodel-styler/" target="_self"&gt;sample&lt;/A&gt;) that creates &lt;EM&gt;graphics&lt;/EM&gt; that are used for geometry queries. The problem is that my code is only using the most recently drawn polygon for the query.&lt;/P&gt;&lt;P&gt;How do I append graphics together so that the user can draw multiple &lt;EM&gt;graphics&lt;/EM&gt; and have the combined areas be used for the geometry query?&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;sketchViewModel.on('create', (event) =&amp;gt; {
        if (event.state === 'complete') {
            sketchGeometry = event.graphics.geometry;
            console.log('sketch created');

            // apply a grayscale feature effect to non selected features
            DataLayers.forEach((layer) =&amp;gt; {
                view.whenLayerView(layer).then((layerView) =&amp;gt; {
                    const featureFilter = { where: fullQuery, geometry: sketchGeometry };
                    layerView.featureEffect = {
                        filter: featureFilter,
                        excludedEffect: 'grayscale(100%) opacity(70%)',
                    };
                });
            });
            updateChartsUsingActiveLayerView();
        }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is using a &lt;EM&gt;groupLayer&lt;/EM&gt; the correct way? If so, how do I get the geometry of all features in the groupLayer.&lt;/P&gt;&lt;P&gt;Thanks for any help!&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jun 2024 19:00:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-group-multiple-graphics-layers-together/m-p/1483457#M84775</guid>
      <dc:creator>Josh-R</dc:creator>
      <dc:date>2024-06-03T19:00:41Z</dc:date>
    </item>
    <item>
      <title>Re: How do I group multiple graphics layers together and get their geometry?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-group-multiple-graphics-layers-together/m-p/1483778#M84781</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/215607"&gt;@Josh-R&lt;/a&gt;&amp;nbsp;What you'll likely want to do is to get all the graphics from the layer attached to the sketchViewModel and then union them together to get a new geometry that is all the graphics combined.&lt;BR /&gt;And then use that to apply the filter.&lt;BR /&gt;&lt;BR /&gt;You can see this in practice in this esri sample.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=highlight-features-by-geometry" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=highlight-features-by-geometry&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Specifically these lines:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;        sketchViewModel.on("create", async (event) =&amp;gt; {
          if (event.state === "complete") {
            // this polygon will be used to query features that intersect it
            const geometries = polygonGraphicsLayer.graphics.map(function (graphic) {
              return graphic.geometry;
            });
            const queryGeometry = await geometryEngineAsync.union(geometries.toArray());
            selectFeatures(queryGeometry);
          }
        });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jun 2024 00:50:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-group-multiple-graphics-layers-together/m-p/1483778#M84781</guid>
      <dc:creator>JamesIng</dc:creator>
      <dc:date>2024-06-04T00:50:34Z</dc:date>
    </item>
    <item>
      <title>Re: How do I group multiple graphics layers together and get their geometry?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-group-multiple-graphics-layers-together/m-p/1484394#M84787</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/666601"&gt;@JamesIng&lt;/a&gt;&amp;nbsp;Thank you so much! This ended up being exactly what I needed and worked for both my create and update functions.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jun 2024 14:38:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-group-multiple-graphics-layers-together/m-p/1484394#M84787</guid>
      <dc:creator>Josh-R</dc:creator>
      <dc:date>2024-06-04T14:38:18Z</dc:date>
    </item>
  </channel>
</rss>

