[mapserver-users] datum transformation with php_proj.dll
Frank Warmerdam
warmerdam at pobox.com
Tue Apr 2 08:17:36 PST 2002
Maul, Andreas-Alexander wrote:
> Hi,
> I have the following problem with php-proj.dll (from
> php4.1.2_php_mapscript_36-dev_libwww.zip) and similar with cs2cs (from
> proj-4.4.3):
> I want to perform a coordinate and datum transformation from geographic
> coordinates (WGS84 ellipsoid) to Gauss-Krueger coordinates (i.e. do a
> transversal Mercator projection with Bessel ellipsoid corresponding to
> epsg:31493) and using php.
> Applying this php code:
>
> <?php
> $lat = doubleval(54.);
> $lon = doubleval( 9.);
>
> $paramll[0] = "proj=latlong";
> $paramll[1] = "ellps=WGS84";
> $projll = pj_init($paramll);
>
> $paramgk[0] = "proj=tmerc";
> $paramgk[1] = "ellps=bessel";
> $paramgk[2] = "lat_0=0.";
> $paramgk[3] = "lon_0=9.";
> $paramgk[4] = "k=1.";
> $paramgk[5] = "x_0=3500000.";
> $paramgk[6] = "y_0=0.";
> $paramgk[7] = "units=m";
> $projgk = pj_init($paramgk);
Andreas,
The problem is that you haven't specified the datums and PROJ.4 doesn't
automatically convert between ellipsoids. If you want do the above
translation and assuming no datum shift is needed (likely a bad assumption)
you would just need to specify "0" datum shift parameters. Use +datum=WGS84
for WGS84, and "+ellps=bessel +towgs84=0,0,0" for the bessel indicating that
no datum shift is required to shift to wgs84.
Hopefully I will incorporate some improved warnings into PROJ.4 in the future
as this is a frequently encountered problem.
Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent
More information about the MapServer-users
mailing list