<?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 4.23 MapView.zoom bug in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/4-23-mapview-zoom-bug/m-p/1165988#M77055</link>
    <description>&lt;P&gt;A new bug in 4.23 causes the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html" target="_self"&gt;MapView&lt;/A&gt;.&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#zoom" target="_self"&gt;zoom&lt;/A&gt; property to read incorrectly as -1 when the (1) &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#constraints" target="_self"&gt;constraints&lt;/A&gt;.lods and (2) &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#extent" target="_self"&gt;extent&lt;/A&gt; properties are specified in the constructor. I noticed this new section titled “&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#mapview-lods" target="_self"&gt;Zoom and LODs&lt;/A&gt;” appeared in the 4.23 documentation, but I’m not doing anything contrary to it to warrant this issue.&lt;/P&gt;&lt;P&gt;To view this in action, go to &lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=intro-mapview" target="_self"&gt;the Sandbox for the “Into to MapView – Create a 2D map” sample&lt;/A&gt;. When there, change this code:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;        const view = new MapView({
          container: "viewDiv",
          map: map,
          zoom: 4,
          center: [15, 65] // longitude, latitude
        });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;to this (it's a little long, but mostly just LODs):&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;        const view = new MapView({
          container: "viewDiv",
          map: map,
          constraints: {
            lods: [
              {
                level: 0,
                resolution: 156543.033928,
                scale: 591657527.591555,
                alias: "World (1:591,657,527)"
              },
              {
                level: 1,
                resolution: 78271.5169639999,
                scale: 295828763.795777,
                alias: "World (1:295,828,763)"
              },
              {
                level: 2,
                resolution: 39135.7584820001,
                scale: 147914381.897889,
                alias: "World (1:147,914,381)"
              },
              {
                level: 3,
                resolution: 19567.8792409999,
                scale: 73957190.948944,
                alias: "Continent (1:73,957,190)"
              },
              {
                level: 4,
                resolution: 9783.93962049996,
                scale: 36978595.474472,
                alias: "Continent (1:36,978,595)"
              },
              {
                level: 5,
                resolution: 4891.96981024998,
                scale: 18489297.737236,
                alias: "Countries (1:18,489,297)"
              },
              {
                level: 6,
                resolution: 2445.98490512499,
                scale: 9244648.868618,
                alias: "Country (1:9,244,648)"
              },
              {
                level: 7,
                resolution: 1222.99245256249,
                scale: 4622324.434309,
                alias: "States / Provinces (1:4,622,324)"
              },
              {
                level: 8,
                resolution: 611.49622628138,
                scale: 2311162.217155,
                alias: "Counties (1:2,311,162)"
              },
              {
                level: 9,
                resolution: 305.748113140558,
                scale: 1155581.108577,
                alias: "Counties (1:1,155,581)"
              },
              {
                level: 10,
                resolution: 152.874056570411,
                scale: 577790.554289,
                alias: "County (1:577,790)"
              },
              {
                level: 11,
                resolution: 76.4370282850732,
                scale: 288895.277144,
                alias: "Metropolitan Area (1:288,895)"
              },
              {
                level: 12,
                resolution: 38.2185141425366,
                scale: 144447.638572,
                alias: "Cities (1:144,447)"
              },
              {
                level: 13,
                resolution: 19.1092570712683,
                scale: 72223.819286,
                alias: "City (1:72,223)"
              },
              {
                level: 14,
                resolution: 9.55462853563415,
                scale: 36111.909643,
                alias: "Town (1:36,111)"
              },
              {
                level: 15,
                resolution: 4.77731426794937,
                scale: 18055.954822,
                alias: "Neighborhood (1:18,055)"
              },
              {
                level: 16,
                resolution: 2.38865713397468,
                scale: 9027.977411,
                alias: "Streets (1:9,027)"
              },
              {
                level: 17,
                resolution: 1.19432856685505,
                scale: 4513.988705,
                alias: "City Block (1:4,513)"
              },
              {
                level: 18,
                resolution: 0.5971642835598172,
                scale: 2256.994353,
                alias: "Buildings (1:2,256)"
              },
              {
                level: 19,
                resolution: 0.29858214164761665,
                scale: 1128.497176,
                alias: "Building (1:1,128)"
              },
              {
                level: 20,
                resolution: 0.1492910708899543,
                scale: 564.248588,
                alias: "Houses (1:564)"
              },
              {
                level: 21,
                resolution: 0.0746455354449772,
                scale: 282.124294,
                alias: "Houses (1:282)"
              }
            ],
            rotationEnabled: true,
            snapToZoom: true
          },
          extent: {
            xmin: -17576195,
            ymin: 2427634,
            xmax: -17573701,
            ymax: 2429488,
            spatialReference: { wkid: 3857 }
          }
        });

        view.when(function () {
          alert(view.zoom);
          view.notifyChange("zoom");
          alert(view.zoom);
        });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then click the Refresh link at the top right of the page. You will see two alerts: -1 and (probably) 15.&lt;/P&gt;&lt;P&gt;To see that this is specific to 4.23, go to the top of the code, and change the “link” and “script” tag urls to use 4.22 instead. After clicking Refresh again, you’ll receive two more alerts: 15 and 15.&amp;nbsp; This demonstrates that what once worked in 4.22 no longer works in 4.23.&lt;/P&gt;&lt;P&gt;When I usually report these things, I try to show where in the API the problem happens, but I’m not able this time. However, I do have a workaround for AMD-based solutions with a locally hosted API.&lt;/P&gt;&lt;P&gt;In esri/views/MapView.js, search for:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;this._set("ready",!0)&lt;/LI-CODE&gt;&lt;P&gt;and then replace with:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;this._set("ready",!0);this.notifyChange("zoom")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 20 Apr 2022 02:24:11 GMT</pubDate>
    <dc:creator>JoelBennett</dc:creator>
    <dc:date>2022-04-20T02:24:11Z</dc:date>
    <item>
      <title>4.23 MapView.zoom bug</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/4-23-mapview-zoom-bug/m-p/1165988#M77055</link>
      <description>&lt;P&gt;A new bug in 4.23 causes the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html" target="_self"&gt;MapView&lt;/A&gt;.&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#zoom" target="_self"&gt;zoom&lt;/A&gt; property to read incorrectly as -1 when the (1) &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#constraints" target="_self"&gt;constraints&lt;/A&gt;.lods and (2) &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#extent" target="_self"&gt;extent&lt;/A&gt; properties are specified in the constructor. I noticed this new section titled “&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#mapview-lods" target="_self"&gt;Zoom and LODs&lt;/A&gt;” appeared in the 4.23 documentation, but I’m not doing anything contrary to it to warrant this issue.&lt;/P&gt;&lt;P&gt;To view this in action, go to &lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=intro-mapview" target="_self"&gt;the Sandbox for the “Into to MapView – Create a 2D map” sample&lt;/A&gt;. When there, change this code:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;        const view = new MapView({
          container: "viewDiv",
          map: map,
          zoom: 4,
          center: [15, 65] // longitude, latitude
        });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;to this (it's a little long, but mostly just LODs):&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;        const view = new MapView({
          container: "viewDiv",
          map: map,
          constraints: {
            lods: [
              {
                level: 0,
                resolution: 156543.033928,
                scale: 591657527.591555,
                alias: "World (1:591,657,527)"
              },
              {
                level: 1,
                resolution: 78271.5169639999,
                scale: 295828763.795777,
                alias: "World (1:295,828,763)"
              },
              {
                level: 2,
                resolution: 39135.7584820001,
                scale: 147914381.897889,
                alias: "World (1:147,914,381)"
              },
              {
                level: 3,
                resolution: 19567.8792409999,
                scale: 73957190.948944,
                alias: "Continent (1:73,957,190)"
              },
              {
                level: 4,
                resolution: 9783.93962049996,
                scale: 36978595.474472,
                alias: "Continent (1:36,978,595)"
              },
              {
                level: 5,
                resolution: 4891.96981024998,
                scale: 18489297.737236,
                alias: "Countries (1:18,489,297)"
              },
              {
                level: 6,
                resolution: 2445.98490512499,
                scale: 9244648.868618,
                alias: "Country (1:9,244,648)"
              },
              {
                level: 7,
                resolution: 1222.99245256249,
                scale: 4622324.434309,
                alias: "States / Provinces (1:4,622,324)"
              },
              {
                level: 8,
                resolution: 611.49622628138,
                scale: 2311162.217155,
                alias: "Counties (1:2,311,162)"
              },
              {
                level: 9,
                resolution: 305.748113140558,
                scale: 1155581.108577,
                alias: "Counties (1:1,155,581)"
              },
              {
                level: 10,
                resolution: 152.874056570411,
                scale: 577790.554289,
                alias: "County (1:577,790)"
              },
              {
                level: 11,
                resolution: 76.4370282850732,
                scale: 288895.277144,
                alias: "Metropolitan Area (1:288,895)"
              },
              {
                level: 12,
                resolution: 38.2185141425366,
                scale: 144447.638572,
                alias: "Cities (1:144,447)"
              },
              {
                level: 13,
                resolution: 19.1092570712683,
                scale: 72223.819286,
                alias: "City (1:72,223)"
              },
              {
                level: 14,
                resolution: 9.55462853563415,
                scale: 36111.909643,
                alias: "Town (1:36,111)"
              },
              {
                level: 15,
                resolution: 4.77731426794937,
                scale: 18055.954822,
                alias: "Neighborhood (1:18,055)"
              },
              {
                level: 16,
                resolution: 2.38865713397468,
                scale: 9027.977411,
                alias: "Streets (1:9,027)"
              },
              {
                level: 17,
                resolution: 1.19432856685505,
                scale: 4513.988705,
                alias: "City Block (1:4,513)"
              },
              {
                level: 18,
                resolution: 0.5971642835598172,
                scale: 2256.994353,
                alias: "Buildings (1:2,256)"
              },
              {
                level: 19,
                resolution: 0.29858214164761665,
                scale: 1128.497176,
                alias: "Building (1:1,128)"
              },
              {
                level: 20,
                resolution: 0.1492910708899543,
                scale: 564.248588,
                alias: "Houses (1:564)"
              },
              {
                level: 21,
                resolution: 0.0746455354449772,
                scale: 282.124294,
                alias: "Houses (1:282)"
              }
            ],
            rotationEnabled: true,
            snapToZoom: true
          },
          extent: {
            xmin: -17576195,
            ymin: 2427634,
            xmax: -17573701,
            ymax: 2429488,
            spatialReference: { wkid: 3857 }
          }
        });

        view.when(function () {
          alert(view.zoom);
          view.notifyChange("zoom");
          alert(view.zoom);
        });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then click the Refresh link at the top right of the page. You will see two alerts: -1 and (probably) 15.&lt;/P&gt;&lt;P&gt;To see that this is specific to 4.23, go to the top of the code, and change the “link” and “script” tag urls to use 4.22 instead. After clicking Refresh again, you’ll receive two more alerts: 15 and 15.&amp;nbsp; This demonstrates that what once worked in 4.22 no longer works in 4.23.&lt;/P&gt;&lt;P&gt;When I usually report these things, I try to show where in the API the problem happens, but I’m not able this time. However, I do have a workaround for AMD-based solutions with a locally hosted API.&lt;/P&gt;&lt;P&gt;In esri/views/MapView.js, search for:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;this._set("ready",!0)&lt;/LI-CODE&gt;&lt;P&gt;and then replace with:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;this._set("ready",!0);this.notifyChange("zoom")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2022 02:24:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/4-23-mapview-zoom-bug/m-p/1165988#M77055</guid>
      <dc:creator>JoelBennett</dc:creator>
      <dc:date>2022-04-20T02:24:11Z</dc:date>
    </item>
    <item>
      <title>Re: 4.23 MapView.zoom bug</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/4-23-mapview-zoom-bug/m-p/1166208#M77065</link>
      <description>&lt;P&gt;Hi there,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for reporting this issue and steps to reproduce it. We did lots of work at 4.23 to add support for switching spatial reference of the MapView at runtime. Unfortunately, it appears that we introduced this issue. We will get it fixed as soon as possible and will let you know once we install a fix.&amp;nbsp;&lt;/P&gt;&lt;P&gt;In meantime, you can keep using your workaround.&amp;nbsp;&lt;/P&gt;&lt;P&gt;-Undral&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2022 16:22:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/4-23-mapview-zoom-bug/m-p/1166208#M77065</guid>
      <dc:creator>UndralBatsukh</dc:creator>
      <dc:date>2022-04-20T16:22:51Z</dc:date>
    </item>
    <item>
      <title>Re: 4.23 MapView.zoom bug</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/4-23-mapview-zoom-bug/m-p/1180671#M77628</link>
      <description>&lt;P&gt;Hi there,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;We fixed this issue at 4.24. You will be able to verify the fix on our next version (&amp;lt;script src="&lt;A href="https://js.arcgis.com/next/" target="_blank"&gt;https://js.arcgis.com/next/&lt;/A&gt;"&amp;gt;&amp;lt;/script&amp;gt;) sometime tomorrow.&amp;nbsp;&lt;/P&gt;&lt;P&gt;-Undral&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jun 2022 16:20:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/4-23-mapview-zoom-bug/m-p/1180671#M77628</guid>
      <dc:creator>UndralBatsukh</dc:creator>
      <dc:date>2022-06-07T16:20:16Z</dc:date>
    </item>
  </channel>
</rss>

