<?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: Select Features by Graphic in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/select-features-by-graphic/m-p/1520912#M85338</link>
    <description>&lt;P&gt;Please take a look at this sample:&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/highlight-features-by-geometry/" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/sample-code/highlight-features-by-geometry/&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 13 Aug 2024 22:44:54 GMT</pubDate>
    <dc:creator>UndralBatsukh</dc:creator>
    <dc:date>2024-08-13T22:44:54Z</dc:date>
    <item>
      <title>Select Features by Graphic</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/select-features-by-graphic/m-p/1520892#M85329</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;I seem to be having issues selecting Features when drawing a Graphic?&amp;nbsp; &amp;nbsp;I have a button click that adds a rectangle GraphicsLayer from the SketchViewModel,&amp;nbsp; but not sure how to get the Geometry of the rectangle to select or query the Features that intersect?&lt;/P&gt;&lt;P&gt;The online examples seem overly complex just for a Geometry intersection?&lt;/P&gt;&lt;P&gt;here is the graphics section that works-&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;const&lt;/SPAN&gt; &lt;SPAN&gt;graphicsrectangleselectLayer&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;GraphicsLayer&lt;/SPAN&gt;&lt;SPAN&gt;({&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;id&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;"tempGraphics"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; });&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;drawRectangle&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;document&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;getElementById&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"rectangleselectButton"&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;drawRectangle&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;onclick&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;function&lt;/SPAN&gt;&lt;SPAN&gt; () {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;sketchViewModelrectangle&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;create&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"rectangle"&lt;/SPAN&gt;&lt;SPAN&gt;); &lt;/SPAN&gt;&lt;SPAN&gt;//polygon&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; };&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;const&lt;/SPAN&gt; &lt;SPAN&gt;sketchViewModelrectangle&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;SketchViewModel&lt;/SPAN&gt;&lt;SPAN&gt;({&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;view&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;view&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;layer&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;graphicsrectangleselectLayer&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; });&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Just need the Geometry/Query/Intersect part?&amp;nbsp; &amp;nbsp;any help would be appreciated.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 13 Aug 2024 21:59:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/select-features-by-graphic/m-p/1520892#M85329</guid>
      <dc:creator>Paco</dc:creator>
      <dc:date>2024-08-13T21:59:51Z</dc:date>
    </item>
    <item>
      <title>Re: Select Features by Graphic</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/select-features-by-graphic/m-p/1520902#M85333</link>
      <description>&lt;P&gt;You'll need to grab the geometry from the graphic that exists on the graphics layer (tempGraphics) and then you can use that geometry to do your intersect query against a set of features.&lt;BR /&gt;&lt;BR /&gt;This sample illustrates it relatively well:&lt;BR /&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=sketch-update-validation" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=sketch-update-validation&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;In this sample they do it on update of sketch - but you can tie it into whatever fits your situation.&lt;BR /&gt;&lt;BR /&gt;The relevant part is:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt; const graphic = event.graphics[0];
          // check if the graphic is intersecting school buffers or is
          // still contained by the boundary polygon as the graphic is being updated
          intersects = geometryEngine.intersects(buffers, graphic.geometry);
          contains = geometryEngine.contains(boundaryPolygon, graphic.geometry);&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;If you want to intersect against a featureLayer you can instead use the graphic.geometry and then do a layer query supplying that geometry as a parameter.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=featurelayer-query-basic" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=featurelayer-query-basic&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2024 22:27:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/select-features-by-graphic/m-p/1520902#M85333</guid>
      <dc:creator>JamesIng</dc:creator>
      <dc:date>2024-08-13T22:27:34Z</dc:date>
    </item>
    <item>
      <title>Re: Select Features by Graphic</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/select-features-by-graphic/m-p/1520912#M85338</link>
      <description>&lt;P&gt;Please take a look at this sample:&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/highlight-features-by-geometry/" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/sample-code/highlight-features-by-geometry/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2024 22:44:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/select-features-by-graphic/m-p/1520912#M85338</guid>
      <dc:creator>UndralBatsukh</dc:creator>
      <dc:date>2024-08-13T22:44:54Z</dc:date>
    </item>
    <item>
      <title>Re: Select Features by Graphic</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/select-features-by-graphic/m-p/1521538#M85352</link>
      <description>&lt;P&gt;Note that that sample isn't working correctly. Draw a rectangle to select features.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Snag_6b4b97.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/112328i8192BA787B803785/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Snag_6b4b97.png" alt="Snag_6b4b97.png" /&gt;&lt;/span&gt; &lt;/P&gt;&lt;P&gt;Clear the selection and draw another rectangle. Both the features in the current rectangle and the previously selected features are highlighted.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Snag_6bb638.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/112329i773623337E0ED1A1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Snag_6bb638.png" alt="Snag_6bb638.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2024 14:16:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/select-features-by-graphic/m-p/1521538#M85352</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2024-08-14T14:16:07Z</dc:date>
    </item>
    <item>
      <title>Re: Select Features by Graphic</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/select-features-by-graphic/m-p/1521595#M85356</link>
      <description>&lt;P&gt;Hi there,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Oh!!! Thank you for reporting the issue!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;highlightIds and features variables are set as arrays at the top of the app so they keep getting features added to them. It needs to be instantiated in the callback so it's clean. I updated the sample and here is a codepen that works -&amp;nbsp;&lt;A href="https://codepen.io/U_B_U/pen/poXdBMx?editors=100" target="_blank" rel="noopener"&gt;https://codepen.io/U_B_U/pen/poXdBMx?editors=100&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The sample should be updated on the SDK page next week.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2024 16:05:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/select-features-by-graphic/m-p/1521595#M85356</guid>
      <dc:creator>UndralBatsukh</dc:creator>
      <dc:date>2024-08-14T16:05:34Z</dc:date>
    </item>
    <item>
      <title>Re: Select Features by Graphic</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/select-features-by-graphic/m-p/1521606#M85358</link>
      <description>&lt;P&gt;What's happening with the Total and Selection counts if you select multiple rectangles without clearing the selection? I've selected just single parks with two rectangles, but the selection says 3.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Snag_dd028d.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/112340i3A764B134F65A61E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Snag_dd028d.png" alt="Snag_dd028d.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Snag_dd2cba.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/112341iADD8FF24DCC43C60/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Snag_dd2cba.png" alt="Snag_dd2cba.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2024 16:19:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/select-features-by-graphic/m-p/1521606#M85358</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2024-08-14T16:19:06Z</dc:date>
    </item>
    <item>
      <title>Re: Select Features by Graphic</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/select-features-by-graphic/m-p/1521631#M85359</link>
      <description>&lt;P&gt;codepen updated&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2024 16:56:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/select-features-by-graphic/m-p/1521631#M85359</guid>
      <dc:creator>UndralBatsukh</dc:creator>
      <dc:date>2024-08-14T16:56:22Z</dc:date>
    </item>
  </channel>
</rss>

