[gdal-dev] gdal function to tell if UTM or lat/lon
Frank Warmerdam
warmerdam at pobox.com
Thu Feb 5 15:49:27 EST 2009
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#4b17d85f5db53978c749780b214c4237
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
More information about the gdal-dev
mailing list