[gdal-dev] Failure with osr.CoordinateTransformationOptions()
Stefano Iacovella
stefano.iacovella at gmail.com
Fri Mar 5 00:42:23 PST 2021
Hi all,
I am trying to use GDAL, via Python bindings, to convert coordinates.
I would like to select a specific transformation when converting among CRS
with different Datums. Reading the documentation my understanding is that I
need to create a osr.CoordinateTransformation with options parameter
valorized properly.
I am using binaries from OSGEO4WIN, the release are 3.1.4 for GDAL and
6.3.2 for PROJ
This is a code snippet I am using to debug:
from osgeo import ogr
from osgeo import osr
source = osr.SpatialReference()
source.ImportFromEPSG(3003)
target = osr.SpatialReference()
target.ImportFromEPSG(4326)
options = osr.CoordinateTransformationOptions()
options.SetOperation("urn:ogc:def:coordinateOperation:EPSG::1169")
transform = osr.CoordinateTransformation(source, target, options)
point = ogr.CreateGeometryFromWkt("POINT (1622987 4756952)")
point.Transform(transform)
print point.ExportToWkt()
I have no errors running it but the coordinates of the point, after the
transformation, are infinite. If I create the CoordinateTransformation
without options like this:
transform = osr.CoordinateTransformation(source, target)
The point coordinates after transformation are ok but of course the
conversion is performed using the Coordinate Operation automatically
selected by the system.
Am I doing something wrong?
Thank you in advance for your help.
All the best,
Stefano
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20210305/995a2293/attachment.html>
More information about the gdal-dev
mailing list