[gdal-dev] question about transform from geo to proj reference system

Matt Funk matze999 at gmail.com
Fri Sep 9 11:31:09 EDT 2011


Hi,
I have a satellite scene specified in geographic coordinates (i.e.
WSG84, lat/lon). For the purpose of interpolating onto a
distance-regular grid i want to transform that data to a projected
systems (UTM). I am using gdal in python. To go from projected to
geographic (the inverse of i what i want to do here) i do:

1) ds = gdal.Open(filename)
2) srs = osr.SpatialReference(ds.GetProjection()); #print "srs:"; print srs
3) targetSRS = srs.CloneGeogCS(); #print "\ntargetSRS:"; print
targetSRS.ExportToPrettyWkt()
4) transform_FileCS_To_RefCS = osr.CoordinateTransformation(srs,targetSRS)
5) gt = ds.GetGeoTransform()

So basically in step 3) is where i "get" the geographic coordinate
system. I had been thinking that there would be a similar CloneProjCS()
of some sort. Since there isn't i am not quite sure how to go about it.
At first i thought i define my own coordinate system (see:
http://www.osgeo.org/pipermail/gdal-dev/2011-June/029070.html) like :
srs = osr.SpatialReference()
srs.SetUTM(18,1)
srs.SetWellKnownGeogCS('WGS84')
dst_ds.SetProjection( srs.ExportToWkt())

The problem with that is that i have to specify the UTM zone. However,
my data can span multiple zones, and i'd really like the zone to be a
return argument back to me from the transform.
I guess i am a little confused about this. I really appreciate anyone
pointing out what i am missing here.

thanks
matt


More information about the gdal-dev mailing list