<?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: ArcGIS JS API 4.34 – Selecting existing graphics using Sketch Widget selection tools in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-js-api-4-34-selecting-existing-graphics/m-p/1680437#M88098</link>
    <description>&lt;P&gt;Thank you Venkat, I managed to adapt the &lt;A title="Sketch and Query" href="https://odoe.net/blog/jsapi-sketch-query/" target="_blank" rel="noopener"&gt;odoe.net&lt;/A&gt; code to the current version of the JS API for ArcGIS, and to my work environment. I can now draw and select external features with the Sketch widget.&lt;/P&gt;</description>
    <pubDate>Wed, 28 Jan 2026 13:23:31 GMT</pubDate>
    <dc:creator>Med-Karim-Rouissi</dc:creator>
    <dc:date>2026-01-28T13:23:31Z</dc:date>
    <item>
      <title>ArcGIS JS API 4.34 – Selecting existing graphics using Sketch Widget selection tools</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-js-api-4-34-selecting-existing-graphics/m-p/1679826#M88084</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;I am working with the &lt;STRONG&gt;ArcGIS API for JavaScript 4.34&lt;/STRONG&gt; in a &lt;STRONG&gt;React + Vite&lt;/STRONG&gt; project (TypeScript).&lt;/P&gt;&lt;P&gt;I would like to know whether it is &lt;STRONG&gt;possible to select existing graphics&lt;/STRONG&gt; (for example, points stored in a GraphicsLayer) &lt;STRONG&gt;using the selection tools of the Sketch widget&lt;/STRONG&gt; (rectangle / lasso), and if so, &lt;STRONG&gt;what the recommended approach is&lt;/STRONG&gt;.&lt;/P&gt;&lt;H4&gt;Technical context&lt;/H4&gt;&lt;UL&gt;&lt;LI&gt;Environment: &lt;STRONG&gt;React + Vite&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;API: &lt;STRONG&gt;ArcGIS JS API 4.34&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;ES module imports, for example:&lt;/LI&gt;&lt;/UL&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;LI-CODE lang="javascript"&gt;import Sketch from "@arcgis/core/widgets/Sketch.js";
import GraphicsLayer from "@arcgis/core/layers/GraphicsLayer.js"; &lt;/LI-CODE&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;UL&gt;&lt;LI&gt;I &lt;STRONG&gt;do not use &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/642472"&gt;@ArcGIS&lt;/a&gt;/map-components&lt;/STRONG&gt;, as my application contains several &lt;STRONG&gt;custom widgets&lt;/STRONG&gt; and an existing React architecture.&lt;/LI&gt;&lt;LI&gt;The Sketch widget is attached to a dedicated GraphicsLayer used only for drawing.&lt;/LI&gt;&lt;LI&gt;The graphics to be selected (points, polygons, etc.) are stored in &lt;STRONG&gt;another existing GraphicsLayer already added to the map&lt;/STRONG&gt;.&lt;/LI&gt;&lt;/UL&gt;&lt;H4&gt;Goal&lt;/H4&gt;&lt;UL&gt;&lt;LI&gt;Use the &lt;STRONG&gt;selection tools of the Sketch widget&lt;/STRONG&gt; (rectangle / lasso)&lt;/LI&gt;&lt;LI&gt;To &lt;STRONG&gt;select existing graphics&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;And retrieve the selected features (IDs or graphics) in order to update React state&lt;/LI&gt;&lt;/UL&gt;&lt;H4&gt;What I have observed&lt;/H4&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;The "create" and "update" events work correctly to retrieve the drawn geometry.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;The documentation indicates that "selection-change" can be accessed via event.toolEventInfo within the "update" event, but:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;TypeScript does not allow listening to "selection-change" directly using sketch.on(...)&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;The exact expected workflow for selecting &lt;STRONG&gt;already existing graphics&lt;/STRONG&gt; is not fully clear&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;I am not sure whether:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;The Sketch widget can directly handle the selection of external graphics&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;Or if the intended approach is to use the drawn geometry to perform a manual spatial selection (e.g. geometryEngine.intersects, etc.)&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;H4&gt;Questions&lt;/H4&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;Is it &lt;STRONG&gt;officially supported&lt;/STRONG&gt; to use the Sketch widget’s selection tools to select existing graphics?&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;If yes, what is the &lt;STRONG&gt;recommended approach&lt;/STRONG&gt; (event, property, or workflow)?&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;If not, what is the &lt;STRONG&gt;best practice&lt;/STRONG&gt; with the 4.x API to implement this kind of selection while keeping the Sketch widget UX?&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Thank you in advance for your help and any examples you may be able to share.&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Karim&lt;/P&gt;</description>
      <pubDate>Sun, 25 Jan 2026 13:25:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-js-api-4-34-selecting-existing-graphics/m-p/1679826#M88084</guid>
      <dc:creator>Med-Karim-Rouissi</dc:creator>
      <dc:date>2026-01-25T13:25:00Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS JS API 4.34 – Selecting existing graphics using Sketch Widget selection tools</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-js-api-4-34-selecting-existing-graphics/m-p/1679839#M88085</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/438851"&gt;@Med-Karim-Rouissi&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;As per understanding, the Sketch widget cannot directly select graphics in external layers; you must use its "Rectangle" or "Lasso" tools to draw a geometry and then manually find intersections using geometryEngine.intersects() against your target layer. Once the geometry is captured in the create event, you can filter your external graphics, extract their IDs, and update your React state accordingly.&lt;BR /&gt;&lt;BR /&gt;If you haven't already seen the video below, I suggest it.&lt;BR /&gt;&lt;A href="https://www.youtube.com/watch?v=8eUMNAZ79gg" target="_blank"&gt;https://www.youtube.com/watch?v=8eUMNAZ79gg&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 25 Jan 2026 18:44:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-js-api-4-34-selecting-existing-graphics/m-p/1679839#M88085</guid>
      <dc:creator>VenkataKondepati</dc:creator>
      <dc:date>2026-01-25T18:44:45Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS JS API 4.34 – Selecting existing graphics using Sketch Widget selection tools</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-js-api-4-34-selecting-existing-graphics/m-p/1679849#M88086</link>
      <description>&lt;P&gt;Thank you for the clarification, Venkat.&lt;/P&gt;&lt;P&gt;I’ll test this approach in my React + Vite setup and will keep you informed of the results.&lt;/P&gt;&lt;P&gt;Thanks again for your help.&lt;/P&gt;&lt;P&gt;Best regards,&lt;BR /&gt;Karim&lt;/P&gt;</description>
      <pubDate>Sun, 25 Jan 2026 21:25:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-js-api-4-34-selecting-existing-graphics/m-p/1679849#M88086</guid>
      <dc:creator>Med-Karim-Rouissi</dc:creator>
      <dc:date>2026-01-25T21:25:12Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS JS API 4.34 – Selecting existing graphics using Sketch Widget selection tools</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-js-api-4-34-selecting-existing-graphics/m-p/1680437#M88098</link>
      <description>&lt;P&gt;Thank you Venkat, I managed to adapt the &lt;A title="Sketch and Query" href="https://odoe.net/blog/jsapi-sketch-query/" target="_blank" rel="noopener"&gt;odoe.net&lt;/A&gt; code to the current version of the JS API for ArcGIS, and to my work environment. I can now draw and select external features with the Sketch widget.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jan 2026 13:23:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-js-api-4-34-selecting-existing-graphics/m-p/1680437#M88098</guid>
      <dc:creator>Med-Karim-Rouissi</dc:creator>
      <dc:date>2026-01-28T13:23:31Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS JS API 4.34 – Selecting existing graphics using Sketch Widget selection tools</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-js-api-4-34-selecting-existing-graphics/m-p/1680440#M88099</link>
      <description>&lt;P&gt;Glad to know.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jan 2026 14:12:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-js-api-4-34-selecting-existing-graphics/m-p/1680440#M88099</guid>
      <dc:creator>VenkataKondepati</dc:creator>
      <dc:date>2026-01-28T14:12:47Z</dc:date>
    </item>
  </channel>
</rss>

