Skip to content

Instantly share code, notes, and snippets.

@blaurt
Created April 20, 2020 05:44
Show Gist options
  • Save blaurt/06d08052232888601ce2d70dad99a803 to your computer and use it in GitHub Desktop.
Save blaurt/06d08052232888601ce2d70dad99a803 to your computer and use it in GitHub Desktop.
const x = (longitude + 180) * (mapWidth / 360);
const latRad = (latitude * Math.PI) / 180;
const mercN = Math.log(Math.tan(Math.PI / 4 + latRad / 2));
const y = mapHeight / 2 - (mapWidth * mercN) / (2 * Math.PI);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment