Last active
March 22, 2019 13:53
-
-
Save maptastik/74b25ce51be8730691f27174fb3d1c55 to your computer and use it in GitHub Desktop.
Arcade expressions for deriving WGS84 decimal degree coordinates
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Hacky method to go from an arbitrary CRS to Spherical Mercator | |
var pnt3857 = Centroid(Buffer(Geometry($feature), 0.000001, 'miles')); | |
// Then we can just use the formulae for Spherical Mercator to WGS84 | |
// Latitude | |
(2 * Atan(Exp(pnt3857.y / 6378137)) - PI / 2) / (PI / 180) | |
// Longitude | |
pnt3857.x / (PI / 180) / 6378137; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Arcade expressions to convert point coordinates from Web Mercator to WGS84 Decimal Degrees | |
// Based on the LibreCalc expressions found at https://wiki.openstreetmap.org/wiki/Mercator | |
// Latitude | |
(2 * Atan(Exp(Geometry($feature).y / 6378137)) - PI / 2) / (PI / 180) | |
// Longitude | |
Geometry($feature).x / (PI / 180) / 6378137 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment