[mapguide-users] RE: Convert lat lon to UTM

Traian Stanev traian.stanev at autodesk.com
Wed May 9 12:35:06 EDT 2007


Well, depends how far you are willing to go with this approach :).
Converting from Albers to LL doesn't seem hard...

http://mathworld.wolfram.com/AlbersEqual-AreaConicProjection.html



-----Original Message-----
From: mapguide-users-bounces at lists.osgeo.org
[mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Jim O'Leary
Sent: Wednesday, May 09, 2007 11:50 AM
To: mapguide-users at lists.osgeo.org
Subject: [mapguide-users] RE: Convert lat lon to UTM


This is an excellent tool. However, I must first convert from BC Albers
to
lat lon. Is there a JavaScript tool for that?

Traian Stanev wrote:
> 
> 
> I can't believe I am recommending this, but if it is a web form, you
can
> just paste the javascript from this page
> (http://home.hiwaay.net/~taylorc/toolbox/geography/geoutm.html) into
your
> form and then call it to do the conversion. The source is free to use.
> 
> It is an alternative to calling MapGuide coordinate system APIs...
> 
> Traian
> 
> 
> -----Original Message-----
> From:	mapguide-users-bounces at lists.osgeo.org on behalf of Jim O'Leary
> Sent:	Tue 5/8/2007 8:01 PM
> To:	mapguide-users at lists.osgeo.org
> Cc:	
> Subject:	[mapguide-users] Convert lat lon to UTM
> 
> 
> Is there a way to convert a lat lon to UTM and extract the zone,
northing,
> and easting? I have a form where the user enters a position either by
> clicking on the map or by manually entering the coordinates. The map
is in
> BC Albers. They can also manually enter the UTM zone, northing, and
> easting
> instead of the lat lon.
> 
> On the database side, it would be nice to convert what the user
entered so
> I
> can put both (lat,  lon) and (UTM zone, northing, easting) in the
> database. 
> 
> I found some code in the Web API Reference under MgCoordinateSystem
that
> might be on the right track:
> 
> $wktProj = 'PROJCS["UTM Zone 18 (NAD 83)", GEOGCS ["NAD 83
(Continental
> US)", DATUM ["NAD 83 (Continental US)", SPHEROID ["GRS 80", 6378137,
> 298.257222101]], PRIMEM [ "Greenwich", 0.000000 ], UNIT ["Decimal
Degree",
> 0.01745329251994330]], PROJECTION ["Transverse Mercator"], PARAMETER
> ["Scale_Factor", 0.999600], PARAMETER ["Central_Meridian",
-75.000000],
> PARAMETER ["False_Easting", 500000.000000], UNIT ["Meter",
> 1.000000000000]]';
>         $coordSysProj = $coordSysFactory->Create($wktProj);
>         $xGeog = -71.061342;
>         $yGeog = 42.355892;
>         $coordinate = $geometryFactory->CreateCoordinateXY($xGeog,
> $yGeog);
>         $convertedCoordinate =
> $coordSysProj->ConvertFromLonLat($coordinate);
>         $xConv = $convertedCoordinate->GetX();
>         $yConv = $convertedCoordinate->GetY();
>         echo  "($xGeog, $yGeog) to ($xConv, $yConv)n";
> 
> However, this code assumes that you know what UTM zone you want. As
well,
> it
> does not show how to extract the northing and easting.
> 
> Thanks
> -- 
> View this message in context:
>
http://www.nabble.com/Convert-lat-lon-to-UTM-tf3712944s16610.html#a10386
280
> Sent from the MapGuide Users mailing list archive at Nabble.com.
> 
> _______________________________________________
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
> 
> 
> 
> 
> _______________________________________________
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
> 
> 

-- 
View this message in context:
http://www.nabble.com/Convert-lat-lon-to-UTM-tf3712944s16610.html#a10397
037
Sent from the MapGuide Users mailing list archive at Nabble.com.

_______________________________________________
mapguide-users mailing list
mapguide-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users




More information about the mapguide-users mailing list