[gdal-dev] exportToPrettyWkt and simplify

Andrew Bell andrew.bell.ia at gmail.com
Wed Apr 21 09:04:55 PDT 2021


On Wed, Apr 21, 2021 at 10:49 AM Even Rouault <even.rouault at spatialys.com>
wrote:

> Andrew,
>
> Le 21/04/2021 à 16:31, Andrew Bell a écrit :
> > exportToPrettyWkt() takes an argument called simplify. If it's set,
> > the FORMAT option is set to WKT1_SIMPLE before a call is made to
> > exportToWkt(). But it seems that WKT1_SIMPLE is also the default
> > format value for exportToWkt(). Perhaps I'm misreading, but it seems
> > like the simplify argument is potentially a no-op, depending on the SRS.
>
> The default format value for exportToWkt() is "WKT1" (with axis and
> authority)
>

Ah. This bit of code makes it seem that they are all synonyms:

     auto wktFormat = PJ_WKT1_GDAL;
    const char* pszFormat = CSLFetchNameValueDef(papszOptions, "FORMAT",
                                    CPLGetConfigOption("OSR_WKT_FORMAT",
""));
    if( EQUAL(pszFormat, "WKT1_ESRI" ) || d->m_bMorphToESRI )
    {
        wktFormat = PJ_WKT1_ESRI;
    }
    else if( EQUAL(pszFormat, "WKT1") ||
             EQUAL(pszFormat, "WKT1_GDAL") ||
             EQUAL(pszFormat, "WKT1_SIMPLE") ||
             EQUAL(pszFormat, "SFSQL") )
    {
        wktFormat = PJ_WKT1_GDAL;
    }

But the code goes on to use both pszFormat and wktFormat. My mistake.


> Which GDAL and PROJ versions do you use ? and what is the reproducer for
> this issue ?
>
> I suspect you might ingest a SRS from a WKT that contains a DATUM[] node
> and try to export that as WKT1something with PROJ < 7.2 (if I remember
> well). PROJ 7.2 got changes to automatically turn a DatumEnsemble as a
> Datum when exporting to WKT1.
>

I'm using PROJ 7.1, which I guess explains the behavior.

Still, it seems like there's no support to get WKT2 from the
exportToPretty() function. Is this correct?

-- 
Andrew Bell
andrew.bell.ia at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20210421/1392d336/attachment-0001.html>


More information about the gdal-dev mailing list