// Arcade Scripting Language for ArcGIS Online or ArcPro but not tested in Pro. // Brian Culpepper sourced this arcade expression within Geonet May 22, 2019 and gives a Lat, Long coordinate pair. // can be used for REST requests. The text lat, long coordinate (label) is formated correctly for google maps api. // SUCH AS FOR DRIVING DIRECTION: https://maps.google.com/?daddr=37.52141082016713,-93.72503339491462 // // EAST geospatial support team - 2019 // Brian Culpepper brian@cast.uark.edu // // Result: 36.071279, -94.159751 // Type: String // // function MetersToLatLon(mx, my) { // Converts XY point from Spherical web Mercator EPSG:900913 to lat/lon in WGS84 Datum // Fuente: http://www.maptiler.org/google-maps-coordinates-tile-bounds-projection/ var originShift = 2.0 * PI * 6378137.0 / 2.0; var lon = (mx / originShift) * 180.0; var lat = (my / originShift) * 180.0; lat = 180.0 / PI * (2.0 * Atan( Exp( lat * PI / 180.0)) - PI / 2.0); return [lat, lon]; } var poly = Geometry($feature); var result = ""; if (!IsEmpty(poly)) { var pnt_centr = Centroid(poly); var latlon = MetersToLatLon(pnt_centr.x, pnt_centr.y); result = Round(latlon[0], 6) + "," + Round(latlon[1], 6); } else { result = ""; } return result; return result;