[gdal-dev] CS transformations

Al Niessner Al.Niessner at gmx.net
Mon Oct 19 14:02:52 PDT 2015


Thanks. Works perfect.

On Mon, 2015-10-19 at 20:54 +0200, Even Rouault wrote:
> Al,
> 
> > 
> > # get the dataset projection and wrap it with spatial reference
> > source = osgeo.osr.SpatialReference()
> > source.SetProjection (ds.GetProjection())
> 
> --> This is not the right method to call. SetProjection(string) is for 
> projection names like 'Transverse_Mercator', etc... but not full WKT 
> definitions
> 
> You want to use instead source.ImportFromWkt(ds.GetProjection())
> 
> > 
> > # build the spatial reference for WGS84
> > target = osgeo.osr.SpatialReference()
> > target.SetWellKnownGeogCS('WGS84')
> > 
> > # make the transform to go between the CS
> > transform = osgeo.osr.CoordinateTransformation(source, target)
> 
> --> You should have received an error message at that point saying there's no 
> translation for '.. a wrong WKT string ...' to PROJ.4
> 
> Even
> 
> -- 
> Spatialys - Geospatial professional services
> http://www.spatialys.com

-- 
Al Niessner

I have never found the companion that was so companionable as solitude.
- From Walden by Henry David Thoreau

The universe is indifferent, and life is brutal; however, it is man's
choice of behavior that makes them malevolent rather than benevolent.

Some will fall in love with life and drink it from a fountain
That is pouring like an avalanche coming down the mountain.
- From the song Pepper by the Butthole Surfers




More information about the gdal-dev mailing list