[mapguide-users] LatLong to UTM

Dave Wilson dave.wilson at autodesk.com
Fri Aug 29 12:00:06 EDT 2008


I could be completely off here, but -71,42 is in North Eastern United States which is definitely not Zone 12.

Dave

From: mapguide-users-bounces at lists.osgeo.org [mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Don C. MacGregor
Sent: Friday, August 29, 2008 8:32 AM
To: mapguide-users at lists.osgeo.org
Subject: [mapguide-users] LatLong to UTM

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



________________________________
[http://us.i1.yimg.com/us.yimg.com/i/ca/iotg_search.jpg]Yahoo! Canada Toolbar : Search from anywhere on the web and bookmark your favourite sites. Download it now! <http://ca.toolbar.yahoo.com/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20080829/1c578a8d/attachment.html


More information about the mapguide-users mailing list