[gdal-dev] CS transformations

Even Rouault even.rouault at spatialys.com
Mon Oct 19 11:54:04 PDT 2015


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


More information about the gdal-dev mailing list