Created
August 24, 2011 19:03
-
-
Save springmeyer/1168887 to your computer and use it in GitHub Desktop.
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
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]; | |
} |
i resolved it with parseFloat, but maybe that should be part of the function itself ?
sure, parseFloat sounds good.
also, heads up that mapnik's proj.forward
may not be fully reliable. Ideally you should use mapnik's ProjTransform.forward not Projection.forward. Only the latter however is currently exposed in node-mapnik. I need to expose the ProjTransform. The problem with Projection.forward is that is makes assumptions about the source projection that may not be as robust as setting up the from->to relationship that is done in ProjTransform.
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
I am running into some issues with this.
These are some of the results.