[mapguide-users] LatLong to UTM
Don C. MacGregor
sir_sunkee at yahoo.ca
Fri Aug 29 10:31:52 EDT 2008
Hi folks,
I am trying to write a script that can convert LatLong point to UTM. Although the script its working but I am not getting the right results. Below please find my script.
$wktProj = 'PROJCS["NAD_1983_UTM_Zone_12N",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-111.0],PARAMETER["Scale_Factor",0.99965242],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]';
$coordSysFactory = new MgCoordinateSystemFactory();
$coordSysProj = $coordSysFactory->Create($wktProj);
$geometryFactory = new MgGeometryFactory();
$xProj = -71.061342;
$yProj= 42.353966647205;
$coordinate = $geometryFactory->CreateCoordinateXY($xProj, $yProj);
$convertedCoordinate = $coordSysProj->ConvertFromLonLat($coordinate);
$xConv = $convertedCoordinate->GetX();
$yConv = $convertedCoordinate->GetY();
I am getting (434696.747152, 6017918.57788) and the correct porjected point is (434700.172, 6017603.009).
Any help in this regard would be highly appreciated.
Thanks
---------------------------------
Yahoo! Canada Toolbar : Search from anywhere on the web and bookmark your favourite sites. Download it now!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20080829/464f697b/attachment.html
More information about the mapguide-users
mailing list