[gdal-dev] GetAxesCount returns a wrong value

Javier Jimenez Shaw j1 at jimenezshaw.com
Tue Apr 27 09:01:22 PDT 2021


Thanks Even.

In the mean time (it is not easy to me patching and rebuilding now) I will
use this helper workaround function (I hope I understood correctly GetAxis
behaviour)

int getAxesCount(const OGRSpatialReference& sr)
{
    int axesCount = 0;
    while (nullptr != sr.GetAxis(nullptr, axesCount, nullptr))
    {
        axesCount++;
    }
    return axesCount;
}

Cheers
.___ ._ ..._ .. . ._.  .___ .. __ . _. . __..  ... .... ._ .__
Entre dos pensamientos racionales
hay infinitos pensamientos irracionales.



On Mon, 26 Apr 2021 at 21:09, Even Rouault <even.rouault at spatialys.com>
wrote:

>
> > Is this a know bug?
> Now, yes :-)
> > Maybe fixed in PROJ 8.0.0? (I had not time to test it there yet)
>
> No, it is GDAL specific. You'll need to patch
> OGRSpatialReference::GetAxesCount() in the ( d->m_pjType ==
> PJ_TYPE_COMPOUND_CRS ) case, to test if a component of the compound CRS
> is a bound CRS, and if so, call proj_crs_get_coordinate_system() on the
> source CRS of the bound CRS ( with proj_get_source_crs() ) and not the
> bound CRS itself
>
> Even
>
>
> --
> http://www.spatialys.com
> My software is free, but my time generally not.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20210427/b203a7ec/attachment.html>


More information about the gdal-dev mailing list