[Proj] mercator projection to spherical ellipsoid from WGS84: question

Scott Ellington scott.ellington at goisc.com
Tue Mar 27 10:10:04 EST 2007


I am trying to use mapserver to reproject some data I have so that it
will display on top of Microsoft's Virtual Earth.  VE uses a Mercator
projection with a spherical ellipsoid.  Details here:


Unfortunately, I am having trouble working out the science behind
getting this reprojection working.  I have put together a set of proj
parameters to describe the output VE projection as so:

+proj=merc +ellps=sphere +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0
+x_0=0.0 +y_0=0 +k=1.0 +units=m +no_defs

And my input data is in WGS84 lat/long:

+proj=latlong +datum=WGS84

However, specifying this as the input and output projection causes my
data to shift downward about 10 minutes of latitude.  I ran some tests
from the command line:

$ proj +proj=merc +ellps=sphere +a=6378137 +b=6378137 +lat_ts=0.0
+lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +no_defs
-84 30
-9350837.23     3503549.84  <---- This is correct

$ cs2cs +proj=latlong +datum=WGS84 +to +proj=merc +ellps=sphere
+a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0
+units=m +towgs84=0,0,0 +no_defs
-84 30
-9350837.23     3482183.15 -5312.58 <--- Not correct.  Y value is
shifted downward

Yet, if I tell proj that my input data is already based on a spherical
ellipsoid, it works:

$ cs2cs +proj=latlong +ellps=sphere +a=6378137 +b=6378137 +lat_ts=0.0
+lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +no_defs +to +proj=merc
+ellps=sphere +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0
+y_0=0 +k=1.0 +units=m +no_defs
-84 30
-9350837.23     3503549.84 0.00 <-- correct

So my workaround has been to specify the input projection in mapserver
as spherical, when it is not, it is WGS84.  My question is this:  Why is
it necessary to do this?  Is there another way to write this cs2cs
reprojection which will allow me to correctly specify my input

Thanks in advance,

Scott Ellington

More information about the Proj mailing list