[gdal-dev] gdal function to tell if UTM or lat/lon

Gong, Shawn (Contractor) Shawn.Gong at drdc-rddc.gc.ca
Thu Feb 5 15:55:06 EST 2009


thanks Frank.

GetUTMZone() method is a C function. Is there a Python function?


Shawn


-----Original Message-----
From: gdal-dev-bounces at lists.osgeo.org
[mailto:gdal-dev-bounces at lists.osgeo.org] On Behalf Of Frank Warmerdam
Sent: Thursday, February 05, 2009 3:49 PM
To: Gong, Shawn (Contractor)
Cc: gdal-dev at lists.osgeo.org
Subject: Re: [gdal-dev] gdal function to tell if UTM or lat/lon

Gong, Shawn (Contractor) wrote:
> hi list,
> 
> I know that in Python ds.GetProjection() ds.GetGCPProjection() will 
> yield "GEOGCS[,DATUM[,SPHEROID[ ..." which can be searched for 
> "Transverse_Mercator" or "degree" strings.
> 
> Is there a more direct way in gdalinfo or Python function to tell if
an 
> image is in UTM or lat/lon right away?

Shawn,

The projections tutorial provides some clues on such things.

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

The "normal" approach would be to turn the WKT from GetProjection() into
an OGRSpatialReference (osr.SpatialReference in Python) object and then
query it for information such as the PROJECTION attribute or call
IsProjected(), IsGeographic(), etc.

Note that some Transverse Mercator projections are UTM, but not all.
The GetUTMZone() method can be used to check if it is specifically UTM
and for what zone:

http://www.gdal.org/ogr/classOGRSpatialReference.html#4b17d85f5db53978c7
49780b214c4237

Also, seaching for degree isn't very meaningful since even projected
coordinate systems have an underlying geographic coordinate system which
will be using the unit degree.

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    | Geospatial Programmer for Rent

_______________________________________________
gdal-dev mailing list
gdal-dev at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev


More information about the gdal-dev mailing list