[mapguide-users] Re: Any coord. system to WGS84 (Google Earth).
What's wrong?
Jose Cerrejon
gis at mapas-sll.com
Sat Apr 3 13:41:13 EDT 2010
Reply to myself with a snippet code that works. Thks to all:
<?php
include '../mapviewerphp/common.php';
include 'utilityfunctions.php';
try{
MgInitializeWebTier($configFilePath);
$coordSys1 =
'PROJCS["ED50-UTM29",GEOGCS["LLERP50-W",DATUM["ERP50-W",SPHEROID["INTNL",6378388.000,297.00000000]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["false_easting",500000.000],PARAMETER["false_northing",0.000],PARAMETER["central_meridian",-9.00000000000000],PARAMETER["scale_factor",0.9996],PARAMETER["latitude_of_origin",0.000],UNIT["Meter",1.00000000000000]]';
$coordSys2 =
'GEOGCS["LL84",DATUM["WGS84",SPHEROID["WGS84",6378137.000,298.25722293]],PRIMEM["Greenwich",0],UNIT["Degree",0.01745329251994]]';
$xArg = 683296;
$yArg = 4126527;
$coordSysFactory = new MgCoordinateSystemFactory();
$geometry = new MgGeometryFactory();
$source = $coordSysFactory->Create($coordSys1);
$target = $coordSysFactory->Create($coordSys2);
$transform = $coordSysFactory->GetTransform($source, $target);
$coordinateArg = $geometry->CreateCoordinateXY($xArg, $yArg);
$coordinate12 = $transform->Transform($coordinateArg);
$xx = $coordinate12->GetX();
$yy = $coordinate12->GetY();
echo " x (original)= ".$xArg." | y (original)= ".$yArg;
echo "<br /> x = ".$xx." | y = ".$yy;
}catch (MgException $e){
echo "<p><strong>Error:</strong> ";
echo $e->GetDetails();
echo "</p>";
}
?>
--
View this message in context: http://n2.nabble.com/Any-coord-system-to-WGS84-Google-Earth-tp1811461p4847699.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
More information about the mapguide-users
mailing list