[gdal-dev] GDAL/OGR coordinate transformations candidate operations priority

Pedro Venâncio pedrongvenancio at gmail.com
Tue Oct 5 14:27:15 PDT 2021


Hi all,

I'm trying to understand what is the transformation used by default by
GDAL/OGR.

For instance, the transformation from EPSG:20790 to EPSG:3763 has two
candidates on PROJ:

C:\OSGeo4W>projinfo -s EPSG:20790 -t EPSG:3763
Candidate operations found: 2
-------------------------------------
Operation No. 1:

unknown id, Inverse of Portuguese National Grid + Lisbon (Lisbon) to Lisbon
(1) + Lisbon to ETRS89 (4) + Portugual TM06, 0.1 m, Portugal - mainland -
onshore.

PROJ string:
+proj=pipeline
  +step +inv +proj=tmerc +lat_0=39.6666666666667 +lon_0=1 +k=1 +x_0=200000
        +y_0=300000 +ellps=intl +pm=lisbon
  +step +proj=hgridshift +grids=pt_dgt_DLx_ETRS89_geo.tif
  +step +proj=tmerc +lat_0=39.6682583333333 +lon_0=-8.13310833333333 +k=1
+x_0=0
        +y_0=0 +ellps=GRS80

WKT2:2019 string:
CONCATENATEDOPERATION["Inverse of Portuguese National Grid + Lisbon
(Lisbon) to Lisbon (1) + Lisbon to ETRS89 (4) + Portugual TM06",
    SOURCECRS[
        PROJCRS["Lisbon (Lisbon) / Portuguese National Grid",
            BASEGEOGCRS["Lisbon (Lisbon)",
                DATUM["Lisbon 1937 (Lisbon)",
                    ELLIPSOID["International 1924",6378388,297,
                        LENGTHUNIT["metre",1]]],
                PRIMEM["Lisbon",-9.13190611111111,
                    ANGLEUNIT["degree",0.0174532925199433]],
                ID["EPSG",4803]],
            CONVERSION["Portuguese National Grid",
                METHOD["Transverse Mercator",
                    ID["EPSG",9807]],
                PARAMETER["Latitude of natural origin",39.6666666666667,
                    ANGLEUNIT["degree",0.0174532925199433],
                    ID["EPSG",8801]],
                PARAMETER["Longitude of natural origin",1,
                    ANGLEUNIT["degree",0.0174532925199433],
                    ID["EPSG",8802]],
                PARAMETER["Scale factor at natural origin",1,
                    SCALEUNIT["unity",1],
                    ID["EPSG",8805]],
                PARAMETER["False easting",200000,
                    LENGTHUNIT["metre",1],
                    ID["EPSG",8806]],
                PARAMETER["False northing",300000,
                    LENGTHUNIT["metre",1],
                    ID["EPSG",8807]]],
            CS[Cartesian,2],
                AXIS["easting (X)",east,
                    ORDER[1],
                    LENGTHUNIT["metre",1]],
                AXIS["northing (Y)",north,
                    ORDER[2],
                    LENGTHUNIT["metre",1]],
            ID["EPSG",20790]]],
    TARGETCRS[
        PROJCRS["ETRS89 / Portugal TM06",
            BASEGEOGCRS["ETRS89",
                ENSEMBLE["European Terrestrial Reference System 1989
ensemble",
                    MEMBER["European Terrestrial Reference Frame 1989"],
                    MEMBER["European Terrestrial Reference Frame 1990"],
                    MEMBER["European Terrestrial Reference Frame 1991"],
                    MEMBER["European Terrestrial Reference Frame 1992"],
                    MEMBER["European Terrestrial Reference Frame 1993"],
                    MEMBER["European Terrestrial Reference Frame 1994"],
                    MEMBER["European Terrestrial Reference Frame 1996"],
                    MEMBER["European Terrestrial Reference Frame 1997"],
                    MEMBER["European Terrestrial Reference Frame 2000"],
                    MEMBER["European Terrestrial Reference Frame 2005"],
                    MEMBER["European Terrestrial Reference Frame 2014"],
                    ELLIPSOID["GRS 1980",6378137,298.257222101,
                        LENGTHUNIT["metre",1]],
                    ENSEMBLEACCURACY[0.1]],
                PRIMEM["Greenwich",0,
                    ANGLEUNIT["degree",0.0174532925199433]],
                ID["EPSG",4258]],
            CONVERSION["Portugual TM06",
                METHOD["Transverse Mercator",
                    ID["EPSG",9807]],
                PARAMETER["Latitude of natural origin",39.6682583333333,
                    ANGLEUNIT["degree",0.0174532925199433],
                    ID["EPSG",8801]],
                PARAMETER["Longitude of natural origin",-8.13310833333333,
                    ANGLEUNIT["degree",0.0174532925199433],
                    ID["EPSG",8802]],
                PARAMETER["Scale factor at natural origin",1,
                    SCALEUNIT["unity",1],
                    ID["EPSG",8805]],
                PARAMETER["False easting",0,
                    LENGTHUNIT["metre",1],
                    ID["EPSG",8806]],
                PARAMETER["False northing",0,
                    LENGTHUNIT["metre",1],
                    ID["EPSG",8807]]],
            CS[Cartesian,2],
                AXIS["easting (X)",east,
                    ORDER[1],
                    LENGTHUNIT["metre",1]],
                AXIS["northing (Y)",north,
                    ORDER[2],
                    LENGTHUNIT["metre",1]],
            ID["EPSG",3763]]],
    STEP[
        CONVERSION["Inverse of Portuguese National Grid",
            METHOD["Inverse of Transverse Mercator",
                ID["INVERSE(EPSG)",9807]],
            PARAMETER["Latitude of natural origin",39.6666666666667,
                ANGLEUNIT["degree",0.0174532925199433],
                ID["EPSG",8801]],
            PARAMETER["Longitude of natural origin",1,
                ANGLEUNIT["degree",0.0174532925199433],
                ID["EPSG",8802]],
            PARAMETER["Scale factor at natural origin",1,
                SCALEUNIT["unity",1],
                ID["EPSG",8805]],
            PARAMETER["False easting",200000,
                LENGTHUNIT["metre",1],
                ID["EPSG",8806]],
            PARAMETER["False northing",300000,
                LENGTHUNIT["metre",1],
                ID["EPSG",8807]],
            ID["INVERSE(EPSG)",19936]]],
    STEP[
        COORDINATEOPERATION["Lisbon (Lisbon) to Lisbon (1)",
            VERSION["IGC-Prt"],
            SOURCECRS[
                GEOGCRS["Lisbon (Lisbon)",
                    DATUM["Lisbon 1937 (Lisbon)",
                        ELLIPSOID["International 1924",6378388,297,
                            LENGTHUNIT["metre",1]]],
                    PRIMEM["Lisbon",-9.13190611111111,
                        ANGLEUNIT["degree",0.0174532925199433]],
                    CS[ellipsoidal,2],
                        AXIS["geodetic latitude (Lat)",north,
                            ORDER[1],
                            ANGLEUNIT["degree",0.0174532925199433]],
                        AXIS["geodetic longitude (Lon)",east,
                            ORDER[2],
                            ANGLEUNIT["degree",0.0174532925199433]],
                    ID["EPSG",4803]]],
            TARGETCRS[
                GEOGCRS["Lisbon",
                    DATUM["Lisbon 1937",
                        ELLIPSOID["International 1924",6378388,297,
                            LENGTHUNIT["metre",1]]],
                    PRIMEM["Greenwich",0,
                        ANGLEUNIT["degree",0.0174532925199433]],
                    CS[ellipsoidal,2],
                        AXIS["geodetic latitude (Lat)",north,
                            ORDER[1],
                            ANGLEUNIT["degree",0.0174532925199433]],
                        AXIS["geodetic longitude (Lon)",east,
                            ORDER[2],
                            ANGLEUNIT["degree",0.0174532925199433]],
                    ID["EPSG",4207]]],
            METHOD["Longitude rotation",
                ID["EPSG",9601]],
            PARAMETER["Longitude offset",-9.13190611111111,
                ANGLEUNIT["degree",0.0174532925199433],
                ID["EPSG",8602]],
            OPERATIONACCURACY[0.0],
            ID["EPSG",1756]]],
    STEP[
        COORDINATEOPERATION["Lisbon to ETRS89 (4)",
            SOURCECRS[
                GEOGCRS["Lisbon",
                    DATUM["Lisbon 1937",
                        ELLIPSOID["International 1924",6378388,297,
                            LENGTHUNIT["metre",1]]],
                    PRIMEM["Greenwich",0,
                        ANGLEUNIT["degree",0.0174532925199433]],
                    CS[ellipsoidal,2],
                        AXIS["geodetic latitude (Lat)",north,
                            ORDER[1],
                            ANGLEUNIT["degree",0.0174532925199433]],
                        AXIS["geodetic longitude (Lon)",east,
                            ORDER[2],
                            ANGLEUNIT["degree",0.0174532925199433]],
                    ID["EPSG",4207]]],
            TARGETCRS[
                GEOGCRS["ETRS89",
                    ENSEMBLE["European Terrestrial Reference System 1989
ensemble",
                        MEMBER["European Terrestrial Reference Frame 1989"],
                        MEMBER["European Terrestrial Reference Frame 1990"],
                        MEMBER["European Terrestrial Reference Frame 1991"],
                        MEMBER["European Terrestrial Reference Frame 1992"],
                        MEMBER["European Terrestrial Reference Frame 1993"],
                        MEMBER["European Terrestrial Reference Frame 1994"],
                        MEMBER["European Terrestrial Reference Frame 1996"],
                        MEMBER["European Terrestrial Reference Frame 1997"],
                        MEMBER["European Terrestrial Reference Frame 2000"],
                        MEMBER["European Terrestrial Reference Frame 2005"],
                        MEMBER["European Terrestrial Reference Frame 2014"],
                        ELLIPSOID["GRS 1980",6378137,298.257222101,
                            LENGTHUNIT["metre",1]],
                        ENSEMBLEACCURACY[0.1]],
                    PRIMEM["Greenwich",0,
                        ANGLEUNIT["degree",0.0174532925199433]],
                    CS[ellipsoidal,2],
                        AXIS["geodetic latitude (Lat)",north,
                            ORDER[1],
                            ANGLEUNIT["degree",0.0174532925199433]],
                        AXIS["geodetic longitude (Lon)",east,
                            ORDER[2],
                            ANGLEUNIT["degree",0.0174532925199433]],
                    ID["EPSG",4258]]],
            METHOD["HORIZONTAL_SHIFT_GTIFF"],
            PARAMETERFILE["Latitude and longitude difference
file","pt_dgt_DLx_ETRS89_geo.tif"],
            OPERATIONACCURACY[0.1],
            ID["DERIVED_FROM(EPSG)",6188],
            REMARK["Derived from 1129 common stations in the national
geodetic network. Residuals at 130 further test points average 0.09m,
maximum 0.30m."]]],
    STEP[
        CONVERSION["Portugual TM06",
            METHOD["Transverse Mercator",
                ID["EPSG",9807]],
            PARAMETER["Latitude of natural origin",39.6682583333333,
                ANGLEUNIT["degree",0.0174532925199433],
                ID["EPSG",8801]],
            PARAMETER["Longitude of natural origin",-8.13310833333333,
                ANGLEUNIT["degree",0.0174532925199433],
                ID["EPSG",8802]],
            PARAMETER["Scale factor at natural origin",1,
                SCALEUNIT["unity",1],
                ID["EPSG",8805]],
            PARAMETER["False easting",0,
                LENGTHUNIT["metre",1],
                ID["EPSG",8806]],
            PARAMETER["False northing",0,
                LENGTHUNIT["metre",1],
                ID["EPSG",8807]],
            ID["EPSG",19853]]],
    USAGE[
        SCOPE["unknown"],
        AREA["Portugal - mainland - onshore."],
        BBOX[36.95,-9.56,42.16,-6.19]]]

-------------------------------------
Operation No. 2:

unknown id, Inverse of Portuguese National Grid + Lisbon (Lisbon) to Lisbon
(1) + Lisbon to ETRS89 (3) + Portugual TM06, 2.5 m, Portugal - mainland -
onshore.

PROJ string:
+proj=pipeline
  +step +inv +proj=tmerc +lat_0=39.6666666666667 +lon_0=1 +k=1 +x_0=200000
        +y_0=300000 +ellps=intl +pm=lisbon
  +step +proj=push +v_3
  +step +proj=cart +ellps=intl
  +step +proj=helmert +x=-303.861 +y=-60.693 +z=103.607
  +step +inv +proj=cart +ellps=GRS80
  +step +proj=pop +v_3
  +step +proj=tmerc +lat_0=39.6682583333333 +lon_0=-8.13310833333333 +k=1
+x_0=0
        +y_0=0 +ellps=GRS80

WKT2:2019 string:
CONCATENATEDOPERATION["Inverse of Portuguese National Grid + Lisbon
(Lisbon) to Lisbon (1) + Lisbon to ETRS89 (3) + Portugual TM06",
    SOURCECRS[
        PROJCRS["Lisbon (Lisbon) / Portuguese National Grid",
            BASEGEOGCRS["Lisbon (Lisbon)",
                DATUM["Lisbon 1937 (Lisbon)",
                    ELLIPSOID["International 1924",6378388,297,
                        LENGTHUNIT["metre",1]]],
                PRIMEM["Lisbon",-9.13190611111111,
                    ANGLEUNIT["degree",0.0174532925199433]],
                ID["EPSG",4803]],
            CONVERSION["Portuguese National Grid",
                METHOD["Transverse Mercator",
                    ID["EPSG",9807]],
                PARAMETER["Latitude of natural origin",39.6666666666667,
                    ANGLEUNIT["degree",0.0174532925199433],
                    ID["EPSG",8801]],
                PARAMETER["Longitude of natural origin",1,
                    ANGLEUNIT["degree",0.0174532925199433],
                    ID["EPSG",8802]],
                PARAMETER["Scale factor at natural origin",1,
                    SCALEUNIT["unity",1],
                    ID["EPSG",8805]],
                PARAMETER["False easting",200000,
                    LENGTHUNIT["metre",1],
                    ID["EPSG",8806]],
                PARAMETER["False northing",300000,
                    LENGTHUNIT["metre",1],
                    ID["EPSG",8807]]],
            CS[Cartesian,2],
                AXIS["easting (X)",east,
                    ORDER[1],
                    LENGTHUNIT["metre",1]],
                AXIS["northing (Y)",north,
                    ORDER[2],
                    LENGTHUNIT["metre",1]],
            ID["EPSG",20790]]],
    TARGETCRS[
        PROJCRS["ETRS89 / Portugal TM06",
            BASEGEOGCRS["ETRS89",
                ENSEMBLE["European Terrestrial Reference System 1989
ensemble",
                    MEMBER["European Terrestrial Reference Frame 1989"],
                    MEMBER["European Terrestrial Reference Frame 1990"],
                    MEMBER["European Terrestrial Reference Frame 1991"],
                    MEMBER["European Terrestrial Reference Frame 1992"],
                    MEMBER["European Terrestrial Reference Frame 1993"],
                    MEMBER["European Terrestrial Reference Frame 1994"],
                    MEMBER["European Terrestrial Reference Frame 1996"],
                    MEMBER["European Terrestrial Reference Frame 1997"],
                    MEMBER["European Terrestrial Reference Frame 2000"],
                    MEMBER["European Terrestrial Reference Frame 2005"],
                    MEMBER["European Terrestrial Reference Frame 2014"],
                    ELLIPSOID["GRS 1980",6378137,298.257222101,
                        LENGTHUNIT["metre",1]],
                    ENSEMBLEACCURACY[0.1]],
                PRIMEM["Greenwich",0,
                    ANGLEUNIT["degree",0.0174532925199433]],
                ID["EPSG",4258]],
            CONVERSION["Portugual TM06",
                METHOD["Transverse Mercator",
                    ID["EPSG",9807]],
                PARAMETER["Latitude of natural origin",39.6682583333333,
                    ANGLEUNIT["degree",0.0174532925199433],
                    ID["EPSG",8801]],
                PARAMETER["Longitude of natural origin",-8.13310833333333,
                    ANGLEUNIT["degree",0.0174532925199433],
                    ID["EPSG",8802]],
                PARAMETER["Scale factor at natural origin",1,
                    SCALEUNIT["unity",1],
                    ID["EPSG",8805]],
                PARAMETER["False easting",0,
                    LENGTHUNIT["metre",1],
                    ID["EPSG",8806]],
                PARAMETER["False northing",0,
                    LENGTHUNIT["metre",1],
                    ID["EPSG",8807]]],
            CS[Cartesian,2],
                AXIS["easting (X)",east,
                    ORDER[1],
                    LENGTHUNIT["metre",1]],
                AXIS["northing (Y)",north,
                    ORDER[2],
                    LENGTHUNIT["metre",1]],
            ID["EPSG",3763]]],
    STEP[
        CONVERSION["Inverse of Portuguese National Grid",
            METHOD["Inverse of Transverse Mercator",
                ID["INVERSE(EPSG)",9807]],
            PARAMETER["Latitude of natural origin",39.6666666666667,
                ANGLEUNIT["degree",0.0174532925199433],
                ID["EPSG",8801]],
            PARAMETER["Longitude of natural origin",1,
                ANGLEUNIT["degree",0.0174532925199433],
                ID["EPSG",8802]],
            PARAMETER["Scale factor at natural origin",1,
                SCALEUNIT["unity",1],
                ID["EPSG",8805]],
            PARAMETER["False easting",200000,
                LENGTHUNIT["metre",1],
                ID["EPSG",8806]],
            PARAMETER["False northing",300000,
                LENGTHUNIT["metre",1],
                ID["EPSG",8807]],
            ID["INVERSE(EPSG)",19936]]],
    STEP[
        COORDINATEOPERATION["Lisbon (Lisbon) to Lisbon (1)",
            VERSION["IGC-Prt"],
            SOURCECRS[
                GEOGCRS["Lisbon (Lisbon)",
                    DATUM["Lisbon 1937 (Lisbon)",
                        ELLIPSOID["International 1924",6378388,297,
                            LENGTHUNIT["metre",1]]],
                    PRIMEM["Lisbon",-9.13190611111111,
                        ANGLEUNIT["degree",0.0174532925199433]],
                    CS[ellipsoidal,2],
                        AXIS["geodetic latitude (Lat)",north,
                            ORDER[1],
                            ANGLEUNIT["degree",0.0174532925199433]],
                        AXIS["geodetic longitude (Lon)",east,
                            ORDER[2],
                            ANGLEUNIT["degree",0.0174532925199433]],
                    ID["EPSG",4803]]],
            TARGETCRS[
                GEOGCRS["Lisbon",
                    DATUM["Lisbon 1937",
                        ELLIPSOID["International 1924",6378388,297,
                            LENGTHUNIT["metre",1]]],
                    PRIMEM["Greenwich",0,
                        ANGLEUNIT["degree",0.0174532925199433]],
                    CS[ellipsoidal,2],
                        AXIS["geodetic latitude (Lat)",north,
                            ORDER[1],
                            ANGLEUNIT["degree",0.0174532925199433]],
                        AXIS["geodetic longitude (Lon)",east,
                            ORDER[2],
                            ANGLEUNIT["degree",0.0174532925199433]],
                    ID["EPSG",4207]]],
            METHOD["Longitude rotation",
                ID["EPSG",9601]],
            PARAMETER["Longitude offset",-9.13190611111111,
                ANGLEUNIT["degree",0.0174532925199433],
                ID["EPSG",8602]],
            OPERATIONACCURACY[0.0],
            ID["EPSG",1756]]],
    STEP[
        COORDINATEOPERATION["Lisbon to ETRS89 (3)",
            VERSION["CGC-Prt 2009 7m"],
            SOURCECRS[
                GEOGCRS["Lisbon",
                    DATUM["Lisbon 1937",
                        ELLIPSOID["International 1924",6378388,297,
                            LENGTHUNIT["metre",1]]],
                    PRIMEM["Greenwich",0,
                        ANGLEUNIT["degree",0.0174532925199433]],
                    CS[ellipsoidal,2],
                        AXIS["geodetic latitude (Lat)",north,
                            ORDER[1],
                            ANGLEUNIT["degree",0.0174532925199433]],
                        AXIS["geodetic longitude (Lon)",east,
                            ORDER[2],
                            ANGLEUNIT["degree",0.0174532925199433]],
                    ID["EPSG",4207]]],
            TARGETCRS[
                GEOGCRS["ETRS89",
                    ENSEMBLE["European Terrestrial Reference System 1989
ensemble",
                        MEMBER["European Terrestrial Reference Frame 1989"],
                        MEMBER["European Terrestrial Reference Frame 1990"],
                        MEMBER["European Terrestrial Reference Frame 1991"],
                        MEMBER["European Terrestrial Reference Frame 1992"],
                        MEMBER["European Terrestrial Reference Frame 1993"],
                        MEMBER["European Terrestrial Reference Frame 1994"],
                        MEMBER["European Terrestrial Reference Frame 1996"],
                        MEMBER["European Terrestrial Reference Frame 1997"],
                        MEMBER["European Terrestrial Reference Frame 2000"],
                        MEMBER["European Terrestrial Reference Frame 2005"],
                        MEMBER["European Terrestrial Reference Frame 2014"],
                        ELLIPSOID["GRS 1980",6378137,298.257222101,
                            LENGTHUNIT["metre",1]],
                        ENSEMBLEACCURACY[0.1]],
                    PRIMEM["Greenwich",0,
                        ANGLEUNIT["degree",0.0174532925199433]],
                    CS[ellipsoidal,2],
                        AXIS["geodetic latitude (Lat)",north,
                            ORDER[1],
                            ANGLEUNIT["degree",0.0174532925199433]],
                        AXIS["geodetic longitude (Lon)",east,
                            ORDER[2],
                            ANGLEUNIT["degree",0.0174532925199433]],
                    ID["EPSG",4258]]],
            METHOD["Geocentric translations (geog2D domain)",
                ID["EPSG",9603]],
            PARAMETER["X-axis translation",-303.861,
                LENGTHUNIT["metre",1],
                ID["EPSG",8605]],
            PARAMETER["Y-axis translation",-60.693,
                LENGTHUNIT["metre",1],
                ID["EPSG",8606]],
            PARAMETER["Z-axis translation",103.607,
                LENGTHUNIT["metre",1],
                ID["EPSG",8607]],
            OPERATIONACCURACY[2.5],
            ID["EPSG",5038],
            REMARK["Derived in July 2009 from 119 common stations. Average
residual at 833 test points 2.5m, maximum 7m. Info source also gives a
Position Vector tfm which is of similar accuracy. Replaces Lisbon to ETRS89
(2) (tfm code 1997)."]]],
    STEP[
        CONVERSION["Portugual TM06",
            METHOD["Transverse Mercator",
                ID["EPSG",9807]],
            PARAMETER["Latitude of natural origin",39.6682583333333,
                ANGLEUNIT["degree",0.0174532925199433],
                ID["EPSG",8801]],
            PARAMETER["Longitude of natural origin",-8.13310833333333,
                ANGLEUNIT["degree",0.0174532925199433],
                ID["EPSG",8802]],
            PARAMETER["Scale factor at natural origin",1,
                SCALEUNIT["unity",1],
                ID["EPSG",8805]],
            PARAMETER["False easting",0,
                LENGTHUNIT["metre",1],
                ID["EPSG",8806]],
            PARAMETER["False northing",0,
                LENGTHUNIT["metre",1],
                ID["EPSG",8807]],
            ID["EPSG",19853]]],
    USAGE[
        SCOPE["unknown"],
        AREA["Portugal - mainland - onshore."],
        BBOX[36.95,-9.56,42.16,-6.19]]]

Operation no. 1 uses grids and has an accuracy of about 0.1 meters,
compared to operation no. 2 that uses a Molodensky transformation and has
an accuracy of 2.5 m.

So, in theory, operation no. 1 should be used by default.

However, testing with gdaltransform:

C:\OSGeo4W>gdaltransform -s_srs EPSG:20790 -t_srs EPSG:3763
Enter X Y [Z [T]] values separated by space, and press Return.
286415 431434
*86412.5265012686 131433.856093867 0*

Using the grids on QGIS and on a web application of the institution that
has produced the NTv2 grids used on PROJ, the transformation output is
*86412.426 131434.171*

The difference is not huge, but this makes me believe that operations like
gdalwarp or ogr2ogr do not use the operation no. 1 by default. Am I right?
Could this be a bug? Or is there a way to force the operation used? How is
the decision managed by GDAL/OGR?

Thank you very much!

Best regards,
Pedro Venâncio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20211005/96f65df2/attachment-0001.html>


More information about the gdal-dev mailing list