different results with proj4js

Jan 6, 2010 at 10:31 AM

    hi,when i use proj4js to transform coords from epsg:4326 to epsg:900913(special mecator), i got different results with proj.net.for example, lonlat(45,45), in proj4js,  result is xy(5009377.085697311, 5621521.486192066), but in proj.net it is  xy(5009377.08569731 , 5591279.08717739).the proj4 string in proj4js is as follows:"+title= Google Mercator EPSG:900913 +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs".

    i don't known which result is right and how to fix. any reply will be appreciated.

Coordinator
Jan 7, 2010 at 7:47 AM

from where do you take toe 900913 definition?

try to use this code to perform coordinate conversion and verify if the results are correct:

http://projnet.codeplex.com/Thread/View.aspx?ThreadId=77458

Feb 7, 2010 at 6:07 PM

I used the code in the link 

http://projnet.codeplex.com/Thread/View.aspx?ThreadId=77458

and the results are indeed different.

Jan 24, 2011 at 12:19 AM

Your proj4 code has got the @nadgrids=null parameter which is (correctly) projecting the WGS84 coordinates with respect to the sphere, rather than the WGS84 ellipsoid. To get the same behaviour in proj.NET, try adding:

PARAMETER["semi_minor",6378137]

into the list of parameters in the WKT of your projection.

See here for more details: http://alastaira.wordpress.com/2011/01/23/the-google-maps-bing-maps-spherical-mercator-projection/