<?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 Buffer not working as expected since upgrading to JS 4.23 in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/buffer-not-working-as-expected-since-upgrading-to/m-p/1166867#M77094</link>
    <description>&lt;P&gt;Since upgrading JS API from 4.17 to 4.23, geometry buffer query is not working well or not working at all. I have two jsitor bins provided below. The first bin was created on&amp;nbsp;11/17/2020; the bin second was created on&amp;nbsp; 4/19/2022.&amp;nbsp; (Any deprecated objects in version 4.23 were updated).&lt;/P&gt;&lt;P&gt;The code is pretty much the same for both, with the exception for line 685 in 4.23 which I need to add in order to prevent a "Missing 'geometry' for identify operation." exception.&lt;/P&gt;&lt;P&gt;I think the view on click event is not triggered as quickly as in 4.17, and when the event is triggered, the&amp;nbsp;&lt;SPAN&gt;sketchViewModel&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;state is "completed" but rarely "active".&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;view&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;on&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"click"&lt;/SPAN&gt;&lt;SPAN&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;function&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;(&lt;/SPAN&gt;&lt;SPAN&gt;event&lt;/SPAN&gt;&lt;SPAN&gt;)&amp;nbsp;{&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;(&lt;/SPAN&gt;&lt;SPAN&gt;sketchViewModel&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;state&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;===&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;"active"&lt;/SPAN&gt;&lt;SPAN&gt;)&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Click the widget in the top right (envelope icon). Click the point icon in the now opened buffer tools panel. Click anywhere on the map. In 4.17, the area will be selected immediately, while in 4.23, nothing!&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;buffer working in esri 4.17&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://jsitor.com/QSx-HVA_s" target="_blank"&gt;https://jsitor.com/QSx-HVA_s&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;buffer not working in esri 4.23&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://jsitor.com/VXMCiFcYr" target="_blank"&gt;https://jsitor.com/VXMCiFcYr&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 21 Apr 2022 22:00:14 GMT</pubDate>
    <dc:creator>GregoryBologna</dc:creator>
    <dc:date>2022-04-21T22:00:14Z</dc:date>
    <item>
      <title>Buffer not working as expected since upgrading to JS 4.23</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/buffer-not-working-as-expected-since-upgrading-to/m-p/1166867#M77094</link>
      <description>&lt;P&gt;Since upgrading JS API from 4.17 to 4.23, geometry buffer query is not working well or not working at all. I have two jsitor bins provided below. The first bin was created on&amp;nbsp;11/17/2020; the bin second was created on&amp;nbsp; 4/19/2022.&amp;nbsp; (Any deprecated objects in version 4.23 were updated).&lt;/P&gt;&lt;P&gt;The code is pretty much the same for both, with the exception for line 685 in 4.23 which I need to add in order to prevent a "Missing 'geometry' for identify operation." exception.&lt;/P&gt;&lt;P&gt;I think the view on click event is not triggered as quickly as in 4.17, and when the event is triggered, the&amp;nbsp;&lt;SPAN&gt;sketchViewModel&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;state is "completed" but rarely "active".&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;view&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;on&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"click"&lt;/SPAN&gt;&lt;SPAN&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;function&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;(&lt;/SPAN&gt;&lt;SPAN&gt;event&lt;/SPAN&gt;&lt;SPAN&gt;)&amp;nbsp;{&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;(&lt;/SPAN&gt;&lt;SPAN&gt;sketchViewModel&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;state&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;===&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;"active"&lt;/SPAN&gt;&lt;SPAN&gt;)&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Click the widget in the top right (envelope icon). Click the point icon in the now opened buffer tools panel. Click anywhere on the map. In 4.17, the area will be selected immediately, while in 4.23, nothing!&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;buffer working in esri 4.17&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://jsitor.com/QSx-HVA_s" target="_blank"&gt;https://jsitor.com/QSx-HVA_s&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;buffer not working in esri 4.23&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://jsitor.com/VXMCiFcYr" target="_blank"&gt;https://jsitor.com/VXMCiFcYr&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2022 22:00:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/buffer-not-working-as-expected-since-upgrading-to/m-p/1166867#M77094</guid>
      <dc:creator>GregoryBologna</dc:creator>
      <dc:date>2022-04-21T22:00:14Z</dc:date>
    </item>
    <item>
      <title>Re: Buffer not working as expected since upgrading to JS 4.23</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/buffer-not-working-as-expected-since-upgrading-to/m-p/1166883#M77096</link>
      <description>&lt;P&gt;It looks like the MapView click event is superseded by Sketch events, so when you try to set the point for your identity geometry it doesn't get set, and you're ternary check for it doesn't pass, so you never actually call the Identify.&lt;/P&gt;&lt;P&gt;You could grab the geometry of the graphic from the sketch&lt;/P&gt;&lt;DIV&gt;&lt;SPAN&gt;params&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;geometry&lt;/SPAN&gt; &lt;SPAN&gt;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;event&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;graphic&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;geometry&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Then you can rework how that click handler works&lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 21 Apr 2022 22:41:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/buffer-not-working-as-expected-since-upgrading-to/m-p/1166883#M77096</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2022-04-21T22:41:59Z</dc:date>
    </item>
    <item>
      <title>Re: Buffer not working as expected since upgrading to JS 4.23</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/buffer-not-working-as-expected-since-upgrading-to/m-p/1166904#M77097</link>
      <description>&lt;P&gt;Thank you, Rene. I’ll give that a try. This has been working for awhile in 4.17, and it will work in 4.23, but the sketchViewModel state is not always returning active. Must be like you say. Do you think 4.23 requires a different buffer handling than 4.17?&lt;/P&gt;</description>
      <pubDate>Fri, 22 Apr 2022 00:48:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/buffer-not-working-as-expected-since-upgrading-to/m-p/1166904#M77097</guid>
      <dc:creator>GregoryBologna</dc:creator>
      <dc:date>2022-04-22T00:48:25Z</dc:date>
    </item>
    <item>
      <title>Re: Buffer not working as expected since upgrading to JS 4.23</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/buffer-not-working-as-expected-since-upgrading-to/m-p/1166909#M77098</link>
      <description>&lt;P&gt;The SketchViewModel state does change. It looks like while it's active, the view "click" event can't be captured. This is probably due to the introduction of snapping over the previous releases.&lt;/P&gt;&lt;P&gt;If you update your code like this, it works.&lt;/P&gt;&lt;P&gt;&lt;A href="https://jsitor.com/oBfmc8eSf" target="_blank"&gt;https://jsitor.com/oBfmc8eSf&lt;/A&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;if (event.state === "complete") {
    if(event.graphic.geometry.type === "point")  {
        params.returnGeometry = true;
        params.geometry = event.graphic.geometry;
        params.mapExtent = view.extent;
        identifyTask.execute(params)
        .then(function (response) {
        var results = response.results;
        let feature = results.map(function (result) {
            var feature = result.feature;
            var layerName = result.layerName;
            feature.attributes.layerName = layerName;
            return feature;
        });             
        if (feature &amp;amp;&amp;amp; feature[0]) {
            sketchGeometry = feature[0].geometry;
            runQuery();
        }
        })["catch"](promiseRejected);
        ...&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you need to do something when the SketchViewModel state is active, you can do something like this.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;sketchViewModel.watch("state", (state) =&amp;gt; {
    if ("active" === state) {
        // stuff
    }
});&lt;/LI-CODE&gt;&lt;P&gt;You just need to refactor a little bit.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Apr 2022 01:49:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/buffer-not-working-as-expected-since-upgrading-to/m-p/1166909#M77098</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2022-04-22T01:49:49Z</dc:date>
    </item>
    <item>
      <title>Re: Buffer not working as expected since upgrading to JS 4.23</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/buffer-not-working-as-expected-since-upgrading-to/m-p/1167239#M77115</link>
      <description>&lt;P&gt;Rene. I removed the check for active and added&amp;nbsp;event.graphic.geometry as shown in your answer. I also don't need to capture the screenPoint anymore. Works great. Thanks.&lt;/P&gt;&lt;PRE&gt;params.geometry = event.graphic.geometry;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Apr 2022 21:09:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/buffer-not-working-as-expected-since-upgrading-to/m-p/1167239#M77115</guid>
      <dc:creator>GregoryBologna</dc:creator>
      <dc:date>2022-04-22T21:09:41Z</dc:date>
    </item>
  </channel>
</rss>

