Skip to content

Instantly share code, notes, and snippets.

/merc.js
Created Mar 19, 2018

Embed
What would you like to do?
function merc(lat, lon) {
let r_major = 6378137.000,
x = r_major * toRadians(lon),
scale = x/lon,
y = 180.0/Math.PI * Math.log(Math.tan(Math.PI/4.0 + lat * (Math.PI/180.0)/2.0)) * scale;
return (x, y)
}
function toRadians (angle) {
return angle * (Math.PI / 180);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.