<?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: Convert webmercator to lambert_72 in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/convert-webmercator-to-lambert-72/m-p/48811#M4292</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;sigh...Correct. &lt;SPAN style="text-decoration: underline; color: #339966;"&gt;&lt;STRONG&gt;Thanks Undral&lt;/STRONG&gt;&lt;/SPAN&gt;..now it works like a charm..&lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/grin.png" /&gt;&lt;/P&gt;&lt;P&gt;I used the .toFixed with a copy/paste of the sample code but read over it.&lt;/P&gt;&lt;DIV data-extension-version="1.0.4"&gt;&lt;/DIV&gt;&lt;DIV data-extension-version="1.0.4"&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 17 Oct 2019 17:47:18 GMT</pubDate>
    <dc:creator>SergeDe_Backer</dc:creator>
    <dc:date>2019-10-17T17:47:18Z</dc:date>
    <item>
      <title>Convert webmercator to lambert_72</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/convert-webmercator-to-lambert-72/m-p/48807#M4288</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it possible to convert the x an y coords from webmercator to lambert_72 (31370)?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Serge&lt;/P&gt;&lt;DIV data-extension-version="1.0.4"&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Oct 2019 09:54:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/convert-webmercator-to-lambert-72/m-p/48807#M4288</guid>
      <dc:creator>SergeDe_Backer</dc:creator>
      <dc:date>2019-10-15T09:54:21Z</dc:date>
    </item>
    <item>
      <title>Re: Convert webmercator to lambert_72</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/convert-webmercator-to-lambert-72/m-p/48808#M4289</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In your related link Todd recommended 'Projection'&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" class="link-titled" href="https://community.esri.com/thread/241705-polygon-drawing-with-lambert72-values-doent-match#comment-883993" title="https://community.esri.com/thread/241705-polygon-drawing-with-lambert72-values-doent-match#comment-883993"&gt;https://community.esri.com/thread/241705-polygon-drawing-with-lambert72-values-doent-match#comment-883993&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To go from one coordinate system to another&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-projection.html" title="https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-projection.html"&gt;projection | ArcGIS API for JavaScript 4.13&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Oct 2019 12:24:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/convert-webmercator-to-lambert-72/m-p/48808#M4289</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2019-10-15T12:24:11Z</dc:date>
    </item>
    <item>
      <title>Re: Convert webmercator to lambert_72</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/convert-webmercator-to-lambert-72/m-p/48809#M4290</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for the link Dan. I am trying to comprehend it&amp;nbsp;&lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have made a small sample which shows me the current coords in WGS84 format (lon/lat). I want them to show me the Lambert_72 coords but I&amp;nbsp;get it to work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On every move of the mouse I do this&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;var outSpatialReference = new SpatialReference({&lt;BR /&gt; wkid: 31370 //lambert&lt;BR /&gt; });&lt;BR /&gt; var wgsPoints = new Point({&lt;BR /&gt; longitude: pt.latitude.toFixed(5),&lt;BR /&gt; latitude: pt.longitude.toFixed(5)&lt;BR /&gt; })&lt;BR /&gt; var projectedPoints = projection.project(wgsPoints, outSpatialReference);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I create an outSpatialReference where I use the wkid for lambert. Then I get the point where the mousecursor is and put it in the projection with the function .project() --&amp;gt;&amp;nbsp;&lt;SPAN style="color: #4c4c4c; background-color: #ffffff;"&gt;Projects a geometry or an array of geometries to the specified output spatial reference.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However I am not really sure about the result being correct since I get coords that don't seem te be correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could anyone see if the code is correct or if I am missing something?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;html&amp;gt;&lt;BR /&gt;&amp;lt;head&amp;gt;&lt;BR /&gt; &amp;lt;meta charset="utf-8"&amp;gt;&lt;BR /&gt; &amp;lt;meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no"&amp;gt;&lt;BR /&gt; &amp;lt;title&amp;gt;ArcGIS JavaScript Tutorials: Select a basemap&amp;lt;/title&amp;gt;&lt;BR /&gt; &amp;lt;style&amp;gt;&lt;BR /&gt; html, body, #viewDiv {&lt;BR /&gt; padding: 0;&lt;BR /&gt; margin: 0;&lt;BR /&gt; height: 100%;&lt;BR /&gt; width: 100%;&lt;BR /&gt; }&lt;BR /&gt; &amp;lt;/style&amp;gt;&lt;BR /&gt; &amp;lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"&amp;gt;&amp;lt;/script&amp;gt;&lt;BR /&gt; &amp;lt;link rel="stylesheet" href="https://js.arcgis.com/4.12/esri/css/main.css"&amp;gt;&lt;BR /&gt; &amp;lt;script src="https://js.arcgis.com/4.11/"&amp;gt;&amp;lt;/script&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;script&amp;gt;&lt;/P&gt;&lt;P&gt;require([&lt;BR /&gt; "esri/Map",&lt;BR /&gt; "esri/request",&lt;BR /&gt; "esri/views/MapView",&lt;BR /&gt; "esri/layers/WMSLayer",&lt;BR /&gt; "esri/Graphic",&lt;BR /&gt; "esri/geometry/Polygon",&lt;BR /&gt; "esri/symbols/SimpleFillSymbol",&lt;BR /&gt; "esri/WebMap",&lt;BR /&gt; "esri/geometry/projection",&lt;BR /&gt; "esri/geometry/SpatialReference",&lt;BR /&gt; "esri/geometry/Extent",&lt;BR /&gt; "esri/geometry/Point"&lt;BR /&gt; ], function (Map, esriRequest, MapView, WMSLayer, Graphic, Polygon, SimpleFillSymbol, WebMap, projection, SpatialReference, Extent, Point) {&lt;/P&gt;&lt;P&gt;layer = new WMSLayer({&lt;BR /&gt; url: 'https://geoservices.informatievlaanderen.be/raadpleegdiensten/GRB-basiskaart/wms?'&lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; var url = "http://loc.geopunt.be/v2/location?"&lt;/P&gt;&lt;P&gt;var map = new Map({&lt;BR /&gt; basemap: "topo-vector" //Dit is je basismap om in te lezen,&lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;map.add(layer); //Hier is de WMS layer die je erop "plakt"&lt;/P&gt;&lt;P&gt;var view = new MapView({&lt;BR /&gt; container: "viewDiv",&lt;BR /&gt; map: map,&lt;BR /&gt; center: [4.474, 51.023], //lon, lat&lt;BR /&gt; zoom: 20,&lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;const cs1 = new SpatialReference({&lt;BR /&gt; wkid: 4272 //PE_GCS_ED_1950&lt;BR /&gt; });&lt;BR /&gt; const cs2 = new SpatialReference({&lt;BR /&gt; wkid: 4167&lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;const extent = new Extent({&lt;BR /&gt; xmin: -186.0,&lt;BR /&gt; ymin: -42.0,&lt;BR /&gt; xmax: -179.0,&lt;BR /&gt; ymax: -38.0&lt;BR /&gt; });&lt;BR /&gt; projection.load().then(function (evt) {&lt;BR /&gt; //const geogtrans = projection.getTransformations(cs1, cs2, extent);&lt;BR /&gt; //geogtrans.forEach(function (geogtran, index) {&lt;BR /&gt; // geogtran.steps.forEach(function (step, index) {&lt;BR /&gt; // console.log("step wkid: ", step.wkid);&lt;BR /&gt; // });&lt;BR /&gt; //});&lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var coordsWidget = document.createElement("div");&lt;BR /&gt; coordsWidget.id = "coordsWidget";&lt;BR /&gt; coordsWidget.className = "esri-widget esri-component";&lt;BR /&gt; coordsWidget.style.padding = "7px 15px 5px";&lt;BR /&gt; coordsWidget.style.width = "500px";&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; view.ui.add(coordsWidget, "bottom-right");&lt;/P&gt;&lt;P&gt;//*** Update lat, lon, zoom and scale ***//&lt;BR /&gt; function showCoordinates(pt) {&lt;/P&gt;&lt;P&gt;var outSpatialReferenceWebMercator = new SpatialReference({ "wkid": 3857});&lt;BR /&gt; var outSpatialReferenceLambert = new SpatialReference({ "wkid": 31370 });&lt;/P&gt;&lt;P&gt;var wgsPoints = new Point({&lt;BR /&gt; longitude: pt.latitude.toFixed(5),&lt;BR /&gt; latitude: pt.longitude.toFixed(5)&lt;BR /&gt; })&lt;BR /&gt; var projected3857 = [];&lt;BR /&gt; var projected31370 = [];&lt;BR /&gt; projected3857 = projection.project(wgsPoints, outSpatialReferenceWebMercator);&lt;BR /&gt; projected31370 = projection.project(wgsPoints, outSpatialReferenceLambert);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; var coords = "Lat/Lon: " + pt.latitude.toFixed(5) + " " + pt.longitude.toFixed(5) + &lt;BR /&gt; "&amp;lt;/br&amp;gt; WebMercator: " + projected3857.x + " " + projected3857.y + &lt;BR /&gt; "&amp;lt;/br&amp;gt; Lambert: " + projected31370.x + " " + projected31370.y + &lt;BR /&gt; "&amp;lt;/br&amp;gt; Scale 1:" + Math.round(view.scale * 1) / 1 +&lt;BR /&gt; " | Zoom " + view.zoom;&lt;BR /&gt; coordsWidget.innerHTML = coords;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; view.watch("stationary", function (isStationary) {&lt;BR /&gt; showCoordinates(view.center);&lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;view.on("pointer-move", function (evt) {&lt;BR /&gt; showCoordinates(view.toMap({ x: evt.x, y: evt.y }));&lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;});&lt;BR /&gt; &amp;lt;/script&amp;gt;&lt;BR /&gt;&amp;lt;/head&amp;gt;&lt;BR /&gt;&amp;lt;body&amp;gt;&lt;BR /&gt; &amp;lt;div id="viewDiv"&amp;gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;/body&amp;gt;&lt;BR /&gt;&amp;lt;/html&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV data-extension-version="1.0.4"&gt;&lt;/DIV&gt;&lt;DIV data-extension-version="1.0.4"&gt;&lt;/DIV&gt;&lt;DIV data-extension-version="1.0.4"&gt;&lt;/DIV&gt;&lt;DIV data-extension-version="1.0.4"&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Oct 2019 13:47:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/convert-webmercator-to-lambert-72/m-p/48809#M4290</guid>
      <dc:creator>SergeDe_Backer</dc:creator>
      <dc:date>2019-10-15T13:47:09Z</dc:date>
    </item>
    <item>
      <title>Re: Convert webmercator to lambert_72</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/convert-webmercator-to-lambert-72/m-p/48810#M4291</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You should not use toFixed! You should just pass in the actual values to get the correct results.&amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;longitude&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; pt&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;latitude&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;toFixed&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;5&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
latitude&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; pt&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;longitude&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;toFixed&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;5&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:53:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/convert-webmercator-to-lambert-72/m-p/48810#M4291</guid>
      <dc:creator>UndralBatsukh</dc:creator>
      <dc:date>2021-12-10T21:53:12Z</dc:date>
    </item>
    <item>
      <title>Re: Convert webmercator to lambert_72</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/convert-webmercator-to-lambert-72/m-p/48811#M4292</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;sigh...Correct. &lt;SPAN style="text-decoration: underline; color: #339966;"&gt;&lt;STRONG&gt;Thanks Undral&lt;/STRONG&gt;&lt;/SPAN&gt;..now it works like a charm..&lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/grin.png" /&gt;&lt;/P&gt;&lt;P&gt;I used the .toFixed with a copy/paste of the sample code but read over it.&lt;/P&gt;&lt;DIV data-extension-version="1.0.4"&gt;&lt;/DIV&gt;&lt;DIV data-extension-version="1.0.4"&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Oct 2019 17:47:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/convert-webmercator-to-lambert-72/m-p/48811#M4292</guid>
      <dc:creator>SergeDe_Backer</dc:creator>
      <dc:date>2019-10-17T17:47:18Z</dc:date>
    </item>
  </channel>
</rss>

