[gdal-dev] Failure with osr.CoordinateTransformationOptions()
Stefano Iacovella
stefano.iacovella at gmail.com
Fri Mar 5 02:22:33 PST 2021
Hi again,
a brief update on my issue.
I discovered that the operation works if I explicitly transform the
coordinates in two steps.
The first step I transform the coordinates from the projected CRS to the
Geodetic CRS, then I can apply the selected Operation.
Is this the correct approach?
Thank you
Stefano
Il giorno ven 5 mar 2021 alle ore 09:42 Stefano Iacovella <
stefano.iacovella at gmail.com> ha scritto:
> 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/51ebfbfc/attachment.html>
More information about the gdal-dev
mailing list