[Proj] mercator projection to spherical ellipsoid from
WGS84:question
Scott Ellington
scott.ellington at goisc.com
Tue Mar 27 15:04:18 EST 2007
Hi,
I meant "correct" as in renders correctly on the map. I should have
specified that.
As for your suggestion to remove the towgs parameter, on proj 4.4.9,
this does nothing
$ 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
$ 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 +no_defs
-84 30
-9350837.23 3482183.15 -5312.58
Proj 4.4.6 however, does:
$ 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
$ ./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 +no_defs
-84 30
-9350837.23 3503549.84 0.000
I believe that something has changed in the way proj handles ellipsoid
conversions. Basically, I would like to find a way to avoid this
conversion without the hack of specifying that the ellipsoids are the
same.
Thanks,
Scott
-----Original Message-----
From: proj-bounces at lists.maptools.org
[mailto:proj-bounces at lists.maptools.org] On Behalf Of Oscar van Vlijmen
Sent: Tuesday, March 27, 2007 3:36 PM
To: PROJ.4 and general Projections Discussions
Subject: Re: [Proj] mercator projection to spherical ellipsoid from
WGS84:question
> From: "Scott Ellington"
> Date: Tue, 27 Mar 2007 11:10:04 -0400
> Subject: [Proj] mercator projection to spherical ellipsoid from WGS84:
> question
> $ 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
>
> ...... 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?
It is possible to do mighty strange things with cs2cs, possibly even
without
knowing it.
I can reproduce your "incorrect" numbers with the following procedure.
Take lon=-84, lat=30 deg. Put them on the WGS84 ellipsoid and convert to
geocentric coordinates with an ellipsoidal procedure.
Now set a sphere with a = 6378137 m and convert the geocentric
coordinates
back to lat, lon on this sphere with a spherical procedure.
Then use these lat, lon to project with a spherical mercator projection.
I got indeed:
easting, northing, height = -9350837.227, 3482183.153, -5312.580
Remedy: do not use +towgs84=0,0,0 in your spherical case.
_______________________________________________
Proj mailing list
Proj at lists.maptools.org
http://lists.maptools.org/mailman/listinfo/proj
More information about the Proj
mailing list