[QGIS-Developer] WKT from QgsGeometry incompatible with OGR

Jorge Gustavo Rocha jgr at di.uminho.pt
Sat Jul 6 03:15:04 PDT 2024


Hi Nyall,

I would say that the focus (on the examples in 6.1.2.6.4) is the 
LocateAlong and LocateBetween methods and the examples used are less 
carefully written. Next to each other, examples on 6.1.2.6.3 and 
6.1.2.6.4 seem written by different contributors.

Page 52 says: "The Well-known Text Representation of Geometry is defined 
below using BNF". That's the WKT representation definition, even if we 
can find some examples failing this notation.

We could support both in QGIS. We can eventually read (parse) both 
notations to keep them consistent with previous WKT outputs, but we 
should write using the BNF notation.

Regards,

Jorge

On 06/07/24 10:02, Nyall Dawson via QGIS-Developer wrote:
>
>
> On Sat, 6 July 2024, 4:56 pm Even Rouault, 
> <even.rouault at spatialys.com> wrote:
>
>     Hi,
>>
>>     Both formats are compliant with the WKT specifications.
>
>     Are they? I may have missed something in the Simple Features spec,
>     but looking at https://portal.ogc.org/files/?artifact_id=25355 , I
>     can't see where it would allow the form {geometryTypeName}Z
>     without a space between {geometryTypeName} and Z.
>
>     For example the BNF at page 56 shows:
>
>     <point z tagged text> ::= point z <point z text>
>
>     The examples at page 62 also show a space
>
>
>
> Hmmmm.... What about the examples in 6.1.2.6.4?
>
> Nyall
>
>     .
>
>     Even
>
>>
>>     Nyall
>>
>>
>>         A minimal example is below. Executing it will return an
>>         exception:
>>         "RuntimeError: OGR Error: Corrupt data"
>>
>>         from osgeo import ogr
>>
>>         qgis_geometyry = QgsGeometry().fromWkt("POINT Z (0 0 0)")
>>         wkt = qgis_geometyry.asWkt() # 'PointZ (0 0 0)'
>>         ogr.CreateGeometryFromWkt(wkt)
>>
>>         _______________________________________________
>>         QGIS-Developer mailing list
>>         QGIS-Developer at lists.osgeo.org
>>         List info:
>>         https://lists.osgeo.org/mailman/listinfo/qgis-developer
>>         Unsubscribe:
>>         https://lists.osgeo.org/mailman/listinfo/qgis-developer
>>
>>
>>     _______________________________________________
>>     QGIS-Developer mailing list
>>     QGIS-Developer at lists.osgeo.org
>>     List info:https://lists.osgeo.org/mailman/listinfo/qgis-developer
>>     Unsubscribe:https://lists.osgeo.org/mailman/listinfo/qgis-developer
>
>     -- 
>     http://www.spatialys.com
>     My software is free, but my time generally not.
>
>
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info:https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe:https://lists.osgeo.org/mailman/listinfo/qgis-developer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20240706/9c724124/attachment.htm>


More information about the QGIS-Developer mailing list