[gdal-dev] GetAxesCount returns a wrong value

Javier Jimenez Shaw j1 at jimenezshaw.com
Mon Apr 26 12:03:45 PDT 2021


If I try to get the number of axes in C++ from the srs "EPSG:29901+5773", I
get different values depending on how I create the wkt.
I am using the method "OGRSpatialReference::GetAxesCount()"

If I create it with projinfo with the option "--boundcrs-to-wgs84", the
number of axis is 0.
and the error message twice
ERROR 1: PROJ: proj_crs_get_coordinate_system: Object is not a SingleCRS

projinfo EPSG:29901+5773 -o WKT1:GDAL --boundcrs-to-wgs84
WKT1:GDAL string:
COMPD_CS["OSNI 1952 / Irish National Grid + EGM96 height",
    PROJCS["OSNI 1952 / Irish National Grid",
        GEOGCS["OSNI 1952",
            DATUM["OSNI_1952",
                SPHEROID["Airy 1830",6377563.396,299.3249646,
                    AUTHORITY["EPSG","7001"]],
                TOWGS84[482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15],
                AUTHORITY["EPSG","6188"]],
            PRIMEM["Greenwich",0,
                AUTHORITY["EPSG","8901"]],
            UNIT["degree",0.0174532925199433,
                AUTHORITY["EPSG","9122"]],
            AUTHORITY["EPSG","4188"]],
        PROJECTION["Transverse_Mercator"],
        PARAMETER["latitude_of_origin",53.5],
        PARAMETER["central_meridian",-8],
        PARAMETER["scale_factor",1],
        PARAMETER["false_easting",200000],
        PARAMETER["false_northing",250000],
        UNIT["metre",1,
            AUTHORITY["EPSG","9001"]],
        AXIS["Easting",EAST],
        AXIS["Northing",NORTH],
        AUTHORITY["EPSG","29901"]],
    VERT_CS["EGM96 height",
        VERT_DATUM["EGM96 geoid",2005,
            EXTENSION["PROJ4_GRIDS","us_nga_egm96_15.tif"],
            AUTHORITY["EPSG","5171"]],
        UNIT["metre",1,
            AUTHORITY["EPSG","9001"]],
        AXIS["Gravity-related height",UP],
        AUTHORITY["EPSG","5773"]]]



When I remove the lines EXTENSION or TOWGS84 (that are the only difference)
from the WKT string, I get 1, 2 or 3 (depending on the combination of
deletion),

Doing more tests, I have the same behaviour with EPSG:25836+5773

Environment: Ubuntu 18.04. Compiled GDAL 3.2.0 and PROJ 7.2.0

Is this a know bug? Maybe fixed in PROJ 8.0.0? (I had not time to test it
there yet)

I do not like TOWGS84 either, but still many people is using it, and
provides WKT including it.

Thanks,
Javier.
.___ ._ ..._ .. . ._.  .___ .. __ . _. . __..  ... .... ._ .__
Entre dos pensamientos racionales
hay infinitos pensamientos irracionales.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20210426/0aac04c1/attachment.html>


More information about the gdal-dev mailing list