[Gdal-dev] OGR projection: lat/long to UTM

Ed McNierney ed at topozone.com
Mon May 26 16:34:29 EDT 2003


Garvan -

You need to calculate the target UTM zone from the input longitude.  It
is possible for a given lat/lon point to be projected into more than one
UTM zone - although purists would object to doing so, there are
practical applications in which that's desirable.

Take the input longitude, add 180, divide by 6, truncate to an integer,
and add 1 to get the standard UTM zone.

	UTM = floor((lon + 180) / 6) + 1


	- Ed

Ed McNierney
President and Chief Mapmaker
TopoZone.com / Maps a la carte, Inc.
73 Princeton Street, Suite 305
North Chelmsford, MA  01863
Phone: (978) 251-4242  Fax: (978) 251-1396
ed at topozone.com


-----Original Message-----
From: Garvan Keeley [mailto:garvank at optech.on.ca] 
Sent: Monday, May 26, 2003 4:05 PM
To: 'gdal-dev at remotesensing.org'
Subject: [Gdal-dev] OGR projection: lat/long to UTM

Is there a way to convert decimal lat/long (unprojected) to UTM without
using WKT?
I can't see how to set the destination projection to UTM without
specifying
the zone. The function SetUTM() requires a zone argument, which isn't
known
until the transform has occurred. 

For example,

OGRSpatialReference source;
source.SetWellKnownGeogCS("WGS84");

OGRSpatialReference destination;
destination.SetWellKnownGeogCS("WGS84"); 
destination.SetUTM();  <--------- this requires a parameter

I think I am going about this the wrong way,
Thanks.

=======================
Garvan Keeley
Programmer/Analyst
Optech Incorporated
100 Wildcat Road
Toronto, Ontario, Canada, M3J 2Z9
Web: http://www.optech.on.ca
Tel: 416.661.5904 x441 
_______________________________________________
Gdal-dev mailing list
Gdal-dev at remotesensing.org
http://remotesensing.org/mailman/listinfo/gdal-dev



More information about the Gdal-dev mailing list