[FWTools] calc UTM coords using python?

Frank Warmerdam warmerdam at pobox.com
Wed Jul 26 11:35:42 EDT 2006


Matt Wilkie wrote:
> Hi there,
> 
> I have a point dbf with an attributes for decimal LAT & LONG. I need to 
> calculate the UTM coordinates and Zone for each point. I've found two 
> python libraries for doing this[*], but I think gdal/ogr already has all 
> this at hand (and I have it installed already). Can someone give me some 
> pointers on how to get started with this? Where do I start reading?
> 
> [*] http://pygps.org/, http://starship.python.net/crew/jhauser/Gproj.html

Matt,

The OGR Projections Tutorial might be helpful for you, though it mostly
addresses stuff from the C++ point of view.

   http://www.gdal.org/ogr/osr_tutorial.html

The Python script http://www.gdal.org/srctree/pymod/samples/tolatlong.py
should show a bit of how to use projections stuff in Python.  In your
case you want to go from lat/long to utm.  There is nothing pre-baked
in OGR to identify the optimal UTM zone for a given point, but it is
relatively easy to find the nearest central meridian since they are all
in six degree increments.

Sorry I don't have something a bit more specific!

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGF, http://osgeo.org



More information about the FWTools mailing list