<?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: get Coordinates in different Spatialreference in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-coordinates-in-different-spatialreference/m-p/1325824#M82158</link>
    <description>&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-projection.html#project" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-projection.html#project&lt;/A&gt;&lt;/P&gt;&lt;P&gt;You will need to call project somewhere in your code. It will be easier and probably perform better to re-project the mouse click, but if you want the map to actually display in&amp;nbsp;&lt;SPAN&gt;WKID: 32638 you will need to do a forEach loop like the first example to re-project all of the graphics.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 06 Sep 2023 12:51:45 GMT</pubDate>
    <dc:creator>JeffreyThompson2</dc:creator>
    <dc:date>2023-09-06T12:51:45Z</dc:date>
    <item>
      <title>get Coordinates in different Spatialreference</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-coordinates-in-different-spatialreference/m-p/1325805#M82157</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using worldelevation3D service to display X-Y-Z coordinates, but X and Y i want to show in WKID: 32638,&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SpatialReference for map i have&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;isGCSWGS1984. To get coordinates i use this code still get different WKID coordinates:&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;let beforeLandslideUrl =
          "https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer";

          const sr1 = new SpatialReference({ wkid: 32638 });

      let beforeLandslideLayer = new ElevationLayer({
            url: beforeLandslideUrl,
            spatialReference: sr1
          });    

 
      view.on("click", function(event) {
        var xyztext = document.getElementById("xyzcheckbox");
        if(xyztext.checked == true){
        // Query both elevation layers for the elevation at the clicked map position
        var position = event.mapPoint;
        var queryBeforeLandslide = beforeLandslideLayer.queryElevation(position);
        // When both query promises resolve execute the following code
        promiseUtils
          .eachAlways([queryBeforeLandslide])
          .then(function(results) {
            var posBeforeLandslide = results[0].value.geometry;
            
            
            // Clear graphics from previous result (if applicable)
            //view.graphics.removeAll();
            //alert("ზღვის დონიდან: " + posBeforeLandslide.z +", " + "x: " + posBeforeLandslide.x + ", " + "y: " + posBeforeLandslide.y)
            // document.getElementById('xyzspan').innerHTML = "X: " + posBeforeLandslide.x.toFixed(2)+ "; " + "Y: " + posBeforeLandslide.y.toFixed(2)+ "; " + "Z: " + posBeforeLandslide.z.toFixed(2);
            document.getElementById('xspan').innerHTML = "X: " + posBeforeLandslide.x.toFixed(2);
            document.getElementById('yspan').innerHTML = "Y: " + posBeforeLandslide.y.toFixed(2);
            document.getElementById('zspan').innerHTML = "Z: " + posBeforeLandslide.z.toFixed(2);
          })
        }
        else
        {
            //view.graphics.removeAll();
        } 
      });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Sep 2023 11:46:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-coordinates-in-different-spatialreference/m-p/1325805#M82157</guid>
      <dc:creator>Vakhtang_Zubiashvili</dc:creator>
      <dc:date>2023-09-06T11:46:37Z</dc:date>
    </item>
    <item>
      <title>Re: get Coordinates in different Spatialreference</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-coordinates-in-different-spatialreference/m-p/1325824#M82158</link>
      <description>&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-projection.html#project" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-projection.html#project&lt;/A&gt;&lt;/P&gt;&lt;P&gt;You will need to call project somewhere in your code. It will be easier and probably perform better to re-project the mouse click, but if you want the map to actually display in&amp;nbsp;&lt;SPAN&gt;WKID: 32638 you will need to do a forEach loop like the first example to re-project all of the graphics.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Sep 2023 12:51:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-coordinates-in-different-spatialreference/m-p/1325824#M82158</guid>
      <dc:creator>JeffreyThompson2</dc:creator>
      <dc:date>2023-09-06T12:51:45Z</dc:date>
    </item>
    <item>
      <title>Re: get Coordinates in different Spatialreference</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-coordinates-in-different-spatialreference/m-p/1326265#M82180</link>
      <description>&lt;P&gt;Thanks Jeffry, you gave me right direction, i simply change projection of clicked point and it works fine. Thanks&lt;/P&gt;&lt;P&gt;Working code:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;    var beforeLandslideUrl =
          "https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer";

      var beforeLandslideLayer = new ElevationLayer({
            url: beforeLandslideUrl
          });    

      view.on("click", function(event) {
        var xyztext = document.getElementById("xyzcheckbox");
        
        if(xyztext.checked == true){
        // Query both elevation layers for the elevation at the clicked map position
        let sr1 = new SpatialReference({ wkid: 32638 });
        var position = event.mapPoint;

        let projectedPoints = projection.project(position, sr1);

        console.log(projectedPoints);

        var queryBeforeLandslide = beforeLandslideLayer.queryElevation(position);
        // When both query promises resolve execute the following code
        promiseUtils
          .eachAlways([queryBeforeLandslide])
          .then(function(results) {
            var posBeforeLandslide = results[0].value.geometry;
            
            document.getElementById('xspan').innerHTML = "X: " + posBeforeLandslide.x.toFixed(2);
            document.getElementById('yspan').innerHTML = "Y: " + posBeforeLandslide.y.toFixed(2);
            document.getElementById('zspan').innerHTML = "Z: " + posBeforeLandslide.z.toFixed(2);
          })
        }
        else
        {
            //view.graphics.removeAll();
        } 
      });&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 07 Sep 2023 08:24:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-coordinates-in-different-spatialreference/m-p/1326265#M82180</guid>
      <dc:creator>Vakhtang_Zubiashvili</dc:creator>
      <dc:date>2023-09-07T08:24:14Z</dc:date>
    </item>
  </channel>
</rss>

