[mapserver-users] datum transformation with php_proj.dll

Maul, Andreas-Alexander Andreas.Maul at bgr.de
Tue Apr 2 10:21:12 EST 2002


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);

$ret = pj_transform($projll, $projgk, $lon, $lat);
$x = $ret["u"];
$y = $ret["v"];

echo "Input:<br>Longitude: $lon <br>Latitude: $lat<br><br>";
echo "Output:<br>x: $x <br>y: $y<br>";
?>

I get the result: longitude 9 deg east  -> x = 3500000. (ok)
                  latitude 54 deg north -> y = 5985297.54 (that is Bessel ->
Bessel ellipsoid)
but it should be: latitude 54 deg north -> y = 5985234.24 (WGS84 -> Bessel
ellipsoid)

These results are the same when transforming 9 deg E, 54 deg N with
cs2cs +proj=latlong +ellps=WGS84 +to +proj=tmerc +ellps=bessel +k=1.
+lat_0=0. +lon_0=9. +x_0=3500000. +y_0=0. -v 
It seems that the transformation uses the same ellipsoid for both systems
(Bessel in this case).

Are there any hints?
Regards,
Andreas



More information about the mapserver-users mailing list