<?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 Coordinates conversion in capture mode in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/coordinates-conversion-in-capture-mode/m-p/1301351#M81455</link>
    <description>&lt;P&gt;Best regards.&lt;BR /&gt;I am using the coordinate conversion widget.&lt;BR /&gt;You may know that the widget has a capture mode that takes the coordinate when you click on the map. I need to implement some logic when that action is performed. Specifically, I need to display the coordinates in a &amp;lt;span&amp;gt; tag right after the map is clicked. Only at that time I need to see the coordinates, does anyone know how I can achieve that?&lt;/P&gt;</description>
    <pubDate>Tue, 20 Jun 2023 23:23:59 GMT</pubDate>
    <dc:creator>DesarrolloGIS</dc:creator>
    <dc:date>2023-06-20T23:23:59Z</dc:date>
    <item>
      <title>Coordinates conversion in capture mode</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/coordinates-conversion-in-capture-mode/m-p/1301351#M81455</link>
      <description>&lt;P&gt;Best regards.&lt;BR /&gt;I am using the coordinate conversion widget.&lt;BR /&gt;You may know that the widget has a capture mode that takes the coordinate when you click on the map. I need to implement some logic when that action is performed. Specifically, I need to display the coordinates in a &amp;lt;span&amp;gt; tag right after the map is clicked. Only at that time I need to see the coordinates, does anyone know how I can achieve that?&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jun 2023 23:23:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/coordinates-conversion-in-capture-mode/m-p/1301351#M81455</guid>
      <dc:creator>DesarrolloGIS</dc:creator>
      <dc:date>2023-06-20T23:23:59Z</dc:date>
    </item>
    <item>
      <title>Re: Coordinates conversion in capture mode</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/coordinates-conversion-in-capture-mode/m-p/1301579#M81459</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/695061"&gt;@DesarrolloGIS&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;The 'currentLocation' property of the widget is watchable, so you can do something whenever it changes:&lt;/P&gt;&lt;P&gt;For example (slightly modified from the widget's &lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=widgets-coordinateconversion" target="_self"&gt;sandbox sample&lt;/A&gt; code):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;&amp;lt;html lang="en"&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;meta charset="utf-8" /&amp;gt;
    &amp;lt;meta
      name="viewport"
      content="initial-scale=1, maximum-scale=1,user-scalable=no"
    /&amp;gt;
    &amp;lt;title&amp;gt;
      CoordinateConversion widget | Sample | ArcGIS Maps SDK for JavaScript 4.27
    &amp;lt;/title&amp;gt;
    &amp;lt;link
      rel="stylesheet"
      href="https://js.arcgis.com/4.27/esri/themes/light/main.css"
    /&amp;gt;
    &amp;lt;style&amp;gt;
      html,
      body,
      #viewDiv {
        padding: 0;
        margin: 0;
        height: 100%;
        width: 100%;
        overflow: hidden;
      }
    &amp;lt;/style&amp;gt;
    &amp;lt;script src="https://js.arcgis.com/4.27/"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script&amp;gt;
      require([
        "esri/views/MapView",
        "esri/widgets/CoordinateConversion",
        "esri/Map"
      ], (MapView, CoordinateConversion, Map) =&amp;gt; {
        const map = new Map({
          basemap: "topo-vector"
        });

        const view = new MapView({
          container: "viewDiv",
          map: map,
          center: [-117.049, 34.485],
          zoom: 12
        });

        const ccWidget = new CoordinateConversion({
          view: view
        });
        
        ccWidget.watch('currentLocation', location =&amp;gt; console.log(location.x, location.y));

        view.ui.add(ccWidget, "bottom-left");
      });
    &amp;lt;/script&amp;gt;
  &amp;lt;/head&amp;gt;

  &amp;lt;body class="calcite"&amp;gt;
    &amp;lt;div id="viewDiv"&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note the line near the end (ccWidget.watch(...))&lt;/P&gt;&lt;P&gt;(PS: in the callback to that watch(), you might be more interested in the ccWidget.conversions property to find the coordinates that are actually converted/displayed - the same approach will work though...when currentLocation changes, update your displayed coordinates either from the widget's currentLocation, or its conversions)&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2023 16:02:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/coordinates-conversion-in-capture-mode/m-p/1301579#M81459</guid>
      <dc:creator>mleahy_cl</dc:creator>
      <dc:date>2023-06-21T16:02:35Z</dc:date>
    </item>
    <item>
      <title>Re: Coordinates conversion in capture mode</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/coordinates-conversion-in-capture-mode/m-p/1302201#M81482</link>
      <description>&lt;LI-CODE lang="javascript"&gt;//Variables._self._view   is the reference to the map view
//coordinate_convers      is the widget instance
handlerViewClick = Variables._self._view.on('immediate-click', async (event) =&amp;gt; {
      mapHasBeenClicked = true
    });

    coordinate_convers.watch('currentLocation', (location) =&amp;gt; {
      const { mode, currentLocation } = coordinate_convers;

      if (mode === 'capture' &amp;amp;&amp;amp; currentLocation &amp;amp;&amp;amp; mapHasBeenClicked) {
          const { longitude, latitude } = location;
          const coordinates = `${longitude}, ${latitude}`;

          if (checkedOptionDecimal &amp;amp;&amp;amp; checkedOptionDecimal.checked) {
              selectSRS.selectedIndex = 7;
              boxForInputCoordinate.value = coordinates;
          } else {
              const formattedCoordinates = WGS_84_SEXAGESIMAL.conversionInfo.convert(location);
              setFormattedCoordinates(formattedCoordinates.coordinate);
          }
      }
    });&lt;/LI-CODE&gt;&lt;P&gt;I have added a couple of validations but in the end I have achieved what I was looking for with the widget. Thank you very much for your help.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jun 2023 19:48:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/coordinates-conversion-in-capture-mode/m-p/1302201#M81482</guid>
      <dc:creator>DesarrolloGIS</dc:creator>
      <dc:date>2023-06-22T19:48:54Z</dc:date>
    </item>
  </channel>
</rss>

