Search code examples
javascriptesriarcgis-js-api

(projection)Lat Long issue in ESRI javascript api version 4.18 and above


Version 4.17 Projection is working fine, but if we use version 4.18 & above then, (lat & long) values going beyond the +/- 180. Working Link: codepen.io/thanhtetaung/pen/NWGRZGJ (version 4.15)


Solution

  • It was a change in behavior for the project() method. The longitudes are no longer "normalized" for project().

    If you want the older ("normalized") behavior, you can use webMercatorUtils.webMercatorToGeographic() which includes a second property that allows you to either normalize or not.

    In your codepen change from projection.project(view.extent, sr4326); to webMercatorUtils.webMercatorToGeographic(view.extent, false);.