Skip to content

Instantly share code, notes, and snippets.

@springmeyer
Created August 24, 2011 19:03
Show Gist options
  • Select an option

  • Save springmeyer/1168887 to your computer and use it in GitHub Desktop.

Select an option

Save springmeyer/1168887 to your computer and use it in GitHub Desktop.
var wgs2merc = function(lon,lat) {
lon = parseFloat(lon);
lat = parseFloat(lat);
var x = lon * 20037508.34 / 180;
var y = Math.log(Math.tan((90 + lat) * Math.PI / 360)) / (Math.PI / 180);
y = y * 20037508.34 / 180;
return [x,y];
}
@springmeyer
Copy link
Author

I'll knock out getting this exposed now: mapnik/node-mapnik#57

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment