<?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: Show x,y Coordinates in UTM in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/show-x-y-coordinates-in-utm/m-p/534886#M49864</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No problem! Conversion to UTM will be a little awkward but should be (relatively) easy. It looks like you need to go Lat/Long-&amp;gt;MGRS-&amp;gt;UTM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FWIW, here's my code using that library:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.on("mouse-move", showCoordinates);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.on("mouse-drag", showCoordinates);

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; function showCoordinates(evt) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //the map is in web mercator but display coordinates in geographic (lat, long)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var mp = webMercatorUtils.webMercatorToGeographic(evt.mapPoint);


&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; u = new USNG2();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var theLatLong = [];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; theLatLong["lon"] = mp.x;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; theLatLong["lat"] = mp.y;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var theUSNG = u.fromLonLat(theLatLong,5).toString();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //display mouse coordinates
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dom.byId("lblCurCoords").innerHTML = "&amp;lt;span style=\"font-weight:bold;\"&amp;gt;Lat/Long:&amp;lt;/span&amp;gt; " + mp.y.toFixed(4) + ", " + mp.x.toFixed(4) + "&amp;lt;br/&amp;gt;" + "&amp;lt;span style=\"font-weight:bold;\"&amp;gt;USNG:&amp;lt;/span&amp;gt; " + theUSNG;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 23:14:14 GMT</pubDate>
    <dc:creator>SteveCole</dc:creator>
    <dc:date>2021-12-11T23:14:14Z</dc:date>
    <item>
      <title>Show x,y Coordinates in UTM</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/show-x-y-coordinates-in-utm/m-p/534881#M49859</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;It seems this isn't possible using webMercatorUtils.project(), I'm just wondering if anyone has found a way to successfully convert a point to UTM? I'm trying to have the mouse coordinates show in UTM (NAD 83 Zone 10), but the following doesn't pass webMercatorUtils.canProject():&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var utmSR = new SpatialReference(102410);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var Point = webMercatorUtils.webMercatorToGeographic(evt.mapPoint);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (webMercatorUtils.canProject(utmPoint, utmSR)) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var utmPoint = webMercatorUtils.project(Point, utmSR);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log(utmPoint.x.toFixed(3) + ", " + utmPoint.y.toFixed(3));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The API reference doesn't say anything about why something might not pass canProject()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A jsfiddle &lt;A href="http://jsfiddle.net/2pYcJ/94/"&gt;here&lt;/A&gt;​&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Aug 2016 20:38:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/show-x-y-coordinates-in-utm/m-p/534881#M49859</guid>
      <dc:creator>LauraMiles1</dc:creator>
      <dc:date>2016-08-10T20:38:14Z</dc:date>
    </item>
    <item>
      <title>Re: Show x,y Coordinates in UTM</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/show-x-y-coordinates-in-utm/m-p/534882#M49860</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Laura,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The WebMercatorUtils are only for converting webmercator to geographic and vice versa.&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/3/jsapi/esri.geometry.webmercatorutils-amd.html" title="https://developers.arcgis.com/javascript/3/jsapi/esri.geometry.webmercatorutils-amd.html"&gt;esri/geometry/webMercatorUtils | API Reference | ArcGIS API for JavaScript 3.17&lt;/A&gt; &lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;&lt;SPAN style="color: #4d4d4d; font-family: 'Lucida Grande', 'Segoe UI', Arial, sans-serif; font-size: 14px;"&gt;Convert Web Mercator coordinates to geographic and vice versa.&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Aug 2016 20:47:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/show-x-y-coordinates-in-utm/m-p/534882#M49860</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2016-08-10T20:47:00Z</dc:date>
    </item>
    <item>
      <title>Re: Show x,y Coordinates in UTM</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/show-x-y-coordinates-in-utm/m-p/534883#M49861</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ah, thanks - my oversight!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Aug 2016 20:49:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/show-x-y-coordinates-in-utm/m-p/534883#M49861</guid>
      <dc:creator>LauraMiles1</dc:creator>
      <dc:date>2016-08-10T20:49:48Z</dc:date>
    </item>
    <item>
      <title>Re: Show x,y Coordinates in UTM</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/show-x-y-coordinates-in-utm/m-p/534884#M49862</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This might be of some use to you. I'm using the &lt;A href="https://github.com/klassenjs/usng_tools"&gt;USNG library&lt;/A&gt; to display USNG values for the cursor's current location in one of my apps. There's some reference to it also supporting UTM so you might be able to use it for your current issue.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Aug 2016 20:58:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/show-x-y-coordinates-in-utm/m-p/534884#M49862</guid>
      <dc:creator>SteveCole</dc:creator>
      <dc:date>2016-08-10T20:58:01Z</dc:date>
    </item>
    <item>
      <title>Re: Show x,y Coordinates in UTM</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/show-x-y-coordinates-in-utm/m-p/534885#M49863</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Steve, that's very helpful thank you - we're looking to add MGRS conversion eventually as well.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Aug 2016 21:06:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/show-x-y-coordinates-in-utm/m-p/534885#M49863</guid>
      <dc:creator>LauraMiles1</dc:creator>
      <dc:date>2016-08-10T21:06:37Z</dc:date>
    </item>
    <item>
      <title>Re: Show x,y Coordinates in UTM</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/show-x-y-coordinates-in-utm/m-p/534886#M49864</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No problem! Conversion to UTM will be a little awkward but should be (relatively) easy. It looks like you need to go Lat/Long-&amp;gt;MGRS-&amp;gt;UTM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FWIW, here's my code using that library:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.on("mouse-move", showCoordinates);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.on("mouse-drag", showCoordinates);

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; function showCoordinates(evt) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //the map is in web mercator but display coordinates in geographic (lat, long)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var mp = webMercatorUtils.webMercatorToGeographic(evt.mapPoint);


&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; u = new USNG2();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var theLatLong = [];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; theLatLong["lon"] = mp.x;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; theLatLong["lat"] = mp.y;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var theUSNG = u.fromLonLat(theLatLong,5).toString();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //display mouse coordinates
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dom.byId("lblCurCoords").innerHTML = "&amp;lt;span style=\"font-weight:bold;\"&amp;gt;Lat/Long:&amp;lt;/span&amp;gt; " + mp.y.toFixed(4) + ", " + mp.x.toFixed(4) + "&amp;lt;br/&amp;gt;" + "&amp;lt;span style=\"font-weight:bold;\"&amp;gt;USNG:&amp;lt;/span&amp;gt; " + theUSNG;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 23:14:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/show-x-y-coordinates-in-utm/m-p/534886#M49864</guid>
      <dc:creator>SteveCole</dc:creator>
      <dc:date>2021-12-11T23:14:14Z</dc:date>
    </item>
    <item>
      <title>Re: Show x,y Coordinates in UTM</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/show-x-y-coordinates-in-utm/m-p/534887#M49865</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to display the coordinates in UTM on a map like this:&amp;nbsp;&lt;A class="link-titled" href="https://developers.arcgis.com/javascript/latest/sample-code/intro-popup/index.html" title="https://developers.arcgis.com/javascript/latest/sample-code/intro-popup/index.html"&gt;Intro to popups | ArcGIS API for JavaScript 4.10&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;view.popup.autoOpenEnabled = false;&lt;BR /&gt; view.on("click", function(event) {&lt;/P&gt;&lt;P&gt;// Get the coordinates of the click on the view&lt;BR /&gt; var lat = Math.round(event.mapPoint.latitude * 1000) / 1000;&lt;BR /&gt; var lon = Math.round(event.mapPoint.longitude * 1000) / 1000;&lt;/P&gt;&lt;P&gt;view.popup.open({&lt;BR /&gt; // Set the popup's title to the coordinates of the location&lt;BR /&gt; title: "Reverse geocode: [" + lon + ", " + lat + "]",&lt;BR /&gt; location: event.mapPoint // Set the location of the popup to the clicked location&lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;// Display the popup&lt;BR /&gt; // Execute a reverse geocode using the clicked location&lt;BR /&gt; locatorTask.locationToAddress(event.mapPoint).then(function(&lt;BR /&gt; response) {&lt;BR /&gt; // If an address is successfully found, show it in the popup's content&lt;BR /&gt; view.popup.content = response.address;&lt;BR /&gt; }).catch(function(error) {&lt;BR /&gt; // If the promise fails and no result is found, show a generic message&lt;BR /&gt; view.popup.content =&lt;BR /&gt; "No address was found for this location";&lt;BR /&gt; });&lt;BR /&gt; });&lt;BR /&gt; });&lt;BR /&gt; &amp;lt;/script&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Can anyone help me with that? Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Feb 2019 04:10:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/show-x-y-coordinates-in-utm/m-p/534887#M49865</guid>
      <dc:creator>MauricioAbreu</dc:creator>
      <dc:date>2019-02-01T04:10:37Z</dc:date>
    </item>
    <item>
      <title>Re: Show x,y Coordinates in UTM</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/show-x-y-coordinates-in-utm/m-p/534888#M49866</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In 3.x, you can use &lt;A href="https://developers.arcgis.com/javascript/3/jsapi/esri.geometry.coordinateformatter-amd.html"&gt;coordinateFormatter&lt;/A&gt;. &lt;A href="https://developers.arcgis.com/javascript/3/jssamples/client_projection.html"&gt;This sample&lt;/A&gt;&amp;nbsp;shows how it can be used.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In 4.x, you can use &lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/widgets-coordinateconversion/index.html"&gt;CoordinateConversion&lt;/A&gt; widget.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Feb 2019 16:02:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/show-x-y-coordinates-in-utm/m-p/534888#M49866</guid>
      <dc:creator>UndralBatsukh</dc:creator>
      <dc:date>2019-02-04T16:02:41Z</dc:date>
    </item>
  </channel>
</rss>

