Select to view content in your preferred language

Covert point geometry to Latitude and Longitude

365
1
05-22-2024 03:23 PM
Status: Open
RyanBohan
Frequent Contributor

Increase functionality for Geometry($feature) to covert point geometry to Latitude and Longitude

This is possible with a bit of arcade, would be great to have a ToLatitude(geometry($feature).x) and ToLongitude(geometry($feature).y)

Arcade Functionality from XanderBakker

RyanBohan_0-1716416019761.png

var x = Geometry($feature).x
var y = Geometry($feature).y

// Converts XY point from Spherical Mercator EPSG:900913 to lat/lon in WGS84 Datum
var originShift = 2.0 * PI * 6378137.0 / 2.0;
var lon = (x / originShift) * 180.0;
var lat = (y / originShift) * 180.0;
lat = 180.0 / PI * (2.0 * Atan( Exp( lat * PI / 180.0)) - PI / 2.0);
return [lat, lon];

 

 

1 Comment
AbiDhakal

Yes, from any projection to Lat/lon.