<?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 xy coordinates when a point is created in ArcGIS Field Maps Questions</title>
    <link>https://community.esri.com/t5/arcgis-field-maps-questions/get-xy-coordinates-when-a-point-is-created/m-p/1255069#M5283</link>
    <description>&lt;P&gt;For all of those who were sitting on the edge of their seats waiting for a solution, here is the script to get the xy coordinates and display in decimal degrees:&lt;/P&gt;&lt;PRE&gt;//To populate X coordinate in decimal

function MetersToLon(x) {

    var originShift = 2.0 * PI * 6378137.0 / 2.0;

    var lon = (x / originShift) * 180.0;
        
    return Round(lon, 3);
}

return MetersToLon(Round(Geometry($feature).X, 6));&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;PRE&gt;//To populate Y coordinate in decimal:

function MetersToLat(y) {

    var originShift = 2.0 * PI * 6378137.0 / 2.0;

    var lat = (y / originShift) * 180.0;

    lat = 180.0 / PI * (2.0 * Atan( Exp( lat * PI / 180.0)) - PI / 2.0);
    return Round(lat,3);
}
return MetersToLat(Round(Geometry($feature).Y, 6));&lt;BR /&gt;&lt;BR /&gt;Here is the article that I got the script from. Thanks esri support for helping me resolve this issue!&lt;BR /&gt;&lt;A href="https://support.esri.com/en/technical-article/000028012#:~:text=values%20in%20meter.-,Optionally%2C%20calculate%20the%20XY%20values%20in%20decimal%20degrees.,-Open%20the%20ArcGIS" target="_blank" rel="noopener"&gt;How To: Calculate XY values using an Arcade expression in ArcGIS Pro (esri.com)&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 03 Feb 2023 22:44:25 GMT</pubDate>
    <dc:creator>janderson_ksninc</dc:creator>
    <dc:date>2023-02-03T22:44:25Z</dc:date>
    <item>
      <title>Get xy coordinates when a point is created</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/get-xy-coordinates-when-a-point-is-created/m-p/1254414#M5274</link>
      <description>&lt;P&gt;I have a client who wants to have the xy coordinates display in the popup window when a new point is collected. I have set up fields to hold the x and y coordinates. I've tried to write an expression to get the x coordinate and add the value to the x coordinate field and the same for the y coordinate field but have had no luck. Is this possible? If so, does someone know an expression that I could use to get the xy coordinates of a newly created point?&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2023 17:26:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/get-xy-coordinates-when-a-point-is-created/m-p/1254414#M5274</guid>
      <dc:creator>janderson_ksninc</dc:creator>
      <dc:date>2023-02-02T17:26:17Z</dc:date>
    </item>
    <item>
      <title>Re: Get xy coordinates when a point is created</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/get-xy-coordinates-when-a-point-is-created/m-p/1254683#M5276</link>
      <description>&lt;P&gt;So I've been able to find an expression that gets the x and y coordinates and saves them to attribute fields with the following formula (edited as necessary for lat/long):&lt;/P&gt;&lt;P&gt;var geom = Geometry($feature)&lt;BR /&gt;if (!IsEmpty(geom)) {&lt;BR /&gt;return geom.x&lt;BR /&gt;} else {&lt;BR /&gt;return null&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;Unfortunately, the results are shown in meters and I need them in decimal degrees. Does anyone have a way to make this happen? From what I understand, it is not a straight-forward calc like converting pixels values from meters to feet in a raster. However, I may be wrong. Could someone please help me resolve this issue?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2023 23:28:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/get-xy-coordinates-when-a-point-is-created/m-p/1254683#M5276</guid>
      <dc:creator>janderson_ksninc</dc:creator>
      <dc:date>2023-02-02T23:28:38Z</dc:date>
    </item>
    <item>
      <title>Re: Get xy coordinates when a point is created</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/get-xy-coordinates-when-a-point-is-created/m-p/1255069#M5283</link>
      <description>&lt;P&gt;For all of those who were sitting on the edge of their seats waiting for a solution, here is the script to get the xy coordinates and display in decimal degrees:&lt;/P&gt;&lt;PRE&gt;//To populate X coordinate in decimal

function MetersToLon(x) {

    var originShift = 2.0 * PI * 6378137.0 / 2.0;

    var lon = (x / originShift) * 180.0;
        
    return Round(lon, 3);
}

return MetersToLon(Round(Geometry($feature).X, 6));&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;PRE&gt;//To populate Y coordinate in decimal:

function MetersToLat(y) {

    var originShift = 2.0 * PI * 6378137.0 / 2.0;

    var lat = (y / originShift) * 180.0;

    lat = 180.0 / PI * (2.0 * Atan( Exp( lat * PI / 180.0)) - PI / 2.0);
    return Round(lat,3);
}
return MetersToLat(Round(Geometry($feature).Y, 6));&lt;BR /&gt;&lt;BR /&gt;Here is the article that I got the script from. Thanks esri support for helping me resolve this issue!&lt;BR /&gt;&lt;A href="https://support.esri.com/en/technical-article/000028012#:~:text=values%20in%20meter.-,Optionally%2C%20calculate%20the%20XY%20values%20in%20decimal%20degrees.,-Open%20the%20ArcGIS" target="_blank" rel="noopener"&gt;How To: Calculate XY values using an Arcade expression in ArcGIS Pro (esri.com)&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 Feb 2023 22:44:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/get-xy-coordinates-when-a-point-is-created/m-p/1255069#M5283</guid>
      <dc:creator>janderson_ksninc</dc:creator>
      <dc:date>2023-02-03T22:44:25Z</dc:date>
    </item>
    <item>
      <title>Re: Get xy coordinates when a point is created</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/get-xy-coordinates-when-a-point-is-created/m-p/1620897#M10929</link>
      <description>&lt;P&gt;Another variation if you need the centroid coordinates of a polygon:&lt;/P&gt;&lt;P&gt;Arcade expression that works in Field Maps:&amp;nbsp;&lt;/P&gt;&lt;P&gt;// Create a function to convert meters to latitude and longitude&lt;BR /&gt;function MetersToLatLon(geometry) {&lt;BR /&gt;if (IsEmpty(geometry)) {&lt;BR /&gt;return [null, null];&lt;BR /&gt;}&lt;BR /&gt;var originShift = 2.0 * PI * 6378137.0 / 2.0;&lt;BR /&gt;var lon = (geometry.x / originShift) * 180.0;&lt;BR /&gt;var lat = (geometry.y / originShift) * 180.0;&lt;BR /&gt;lat = 180.0 / PI * (2.0 * Atan( Exp( lat * PI / 180.0)) - PI / 2.0);&lt;BR /&gt;return [Round(lat, 6), Round(lon, 6)];&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;// Function to get latitude from the centroid&lt;BR /&gt;function CentroidLatitude(feature) {&lt;BR /&gt;var centroid = Centroid(feature);&lt;BR /&gt;return MetersToLatLon(centroid)[0]; // Latitude&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;// Function to get longitude from the centroid&lt;BR /&gt;function CentroidLongitude(feature) {&lt;BR /&gt;var centroid = Centroid(feature);&lt;BR /&gt;return MetersToLatLon(centroid)[1]; // Longitude&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;// Call each function separately&lt;BR /&gt;CentroidLatitude($feature);&lt;BR /&gt;CentroidLongitude($feature);&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jun 2025 17:36:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/get-xy-coordinates-when-a-point-is-created/m-p/1620897#M10929</guid>
      <dc:creator>LayerItOn</dc:creator>
      <dc:date>2025-06-04T17:36:50Z</dc:date>
    </item>
  </channel>
</rss>

