[Proj] Google Mercator Projection

Craig Bruce csbruce at cubewerx.com
Mon Oct 15 17:17:43 EDT 2007


I am having a problem converting coordinate values from WGS84 Geographic to
the Mercator projection that Google Maps uses.  This case works correctly:

% cs2cs +proj=latlong +datum=WGS84 +ellps=WGS84 +to +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +nadgrids=@null
-66 45
-7347086.39     5621521.49 -0.00

but if I go above 45° latitude, it stops working:

% cs2cs +proj=latlong +datum=WGS84 +ellps=WGS84 +to +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +nadgrids=@null
-66 46
*       * -0.00

If I remove the "+nadgrids", it returns a result, but the Y value is off
by about 30 km from where it should be.

% cs2cs +proj=latlong +datum=WGS84 +ellps=WGS84 +to +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0                
-66 46
-7347086.39     5749581.82 -11020.66

I am using proj 4.4.8.  It looks like whatever formula changes the Z
coordinate value to 0 conks out a 45° latitude.

--------------------------+----------------------+--------------------------
Dr. Craig S. Bruce        | Ph 819-771-8303 x205 |             CubeWerx Inc.
Senior Software Developer |   Fax 819-771-8388   |  Gatineau, Québec, Canada
csbruce at cubewerx.com      |  http://csbruce.com/ |  http://www.cubewerx.com/
--------------------------+----------------------+--------------------------
                "If the shoe fits, it is probably worn out."


More information about the Proj mailing list