[Proj] mercator projection to spherical ellipsoid from WGS84

Scott Ellington scott.ellington at goisc.com
Wed Mar 28 07:53:53 EST 2007


Hi,

Thanks for your response.  As I replied earlier, it appears in the latest versions of proj that you cannot avoid the datum transformation simply by removing the towgs84 parameter.  I am wondering if there is now a way to avoid the datum transformation without setting the input ellipsoid to match the output...

Scott

-----Original Message-----
From: proj-bounces at lists.maptools.org [mailto:proj-bounces at lists.maptools.org] On Behalf Of Melita Kennedy
Sent: Tuesday, March 27, 2007 9:29 PM
To: proj at lists.maptools.org
Subject: Re: [Proj] mercator projection to spherical ellipsoid from WGS84

Scott,

The reason why you got different results in cs2cs the first time is because you set the input datum to wgs84 and you provided datum transformation parameters in +towgs84=0,0,0. The code did this: 

1. Input degrees were converted to XYZ (3D Cartesian) using wgs84 ellipsoid parameters
2. Datum transformation performed - no change because the parameters were zeroes
3. Output XYZ values converted to decimal degrees using sphere parameters 
4. Output degrees projected to Mercator

This causes a latitude shift that you won't see if the datum transformation code is bypassed or you set the input ellipsoid/sphere to match the output. 

Melita 

------------------------------
Date: Tue, 27 Mar 2007 11:10:04 -0400
From: "Scott Ellington" <scott.ellington at goisc.com>
Subject: [Proj] mercator projection to spherical ellipsoid from WGS84:
	question
To: <proj at lists.maptools.org>

Hello,

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:

http://msdn2.microsoft.com/en-us/library/bb259689.aspx

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
projection?

Thanks in advance,

Scott Ellington
------------------------------

_______________________________________________
Proj mailing list
Proj at lists.maptools.org
http://lists.maptools.org/mailman/listinfo/proj



More information about the Proj mailing list