Skip to content

Instantly share code, notes, and snippets.

Created March 19, 2018 04:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/3c82d80547d3ed26baf5d87f85855198 to your computer and use it in GitHub Desktop.
Save anonymous/3c82d80547d3ed26baf5d87f85855198 to your computer and use it in GitHub Desktop.
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