Opened 10 years ago

Closed 2 years ago

#3431 closed enhancement (fixed)

OGRGeometry::exportToWkt generates 'old-style' 3D WKT.

Reported by: ftrastour Owned by: warmerdam
Priority: normal Milestone:
Component: OGR_SF Version: unspecified
Severity: normal Keywords: WKT 2DF Z
Cc: dev@…

Description

The WKT string generated by the exportToWkt functions family doesn't follow the recent WKT specifications for 3D geometries.

The ' Z' string should be appended to the geometry name when a 2.5D/3D geometry is exported.

The attached example should generate :

LINESTRING Z(10 20 30,11 21 31,12 22 32)

instead of :

LINESTRING (10 20 30,11 21 31,12 22 32)

Attachments (1)

export_to_wkt.py (202 bytes) - added by ftrastour 10 years ago.
Sample python file showing the problem

Download all attachments as: .zip

Change History (5)

Changed 10 years ago by ftrastour

Attachment: export_to_wkt.py added

Sample python file showing the problem

comment:1 Changed 10 years ago by warmerdam

Component: defaultOGR_SF

I believe it could be dangerous to change the behavior of these existing functions. But I think what should be done is:

1) modify importFromWkt() to support old style, and ISO SQL-MM / SF-SQL 1.2 style WKT transparently.

2) add an exportToSF12Wkt() method (or perhaps there is a better description of the new format).

comment:2 Changed 10 years ago by Even Rouault

Version: 1.7.1unspecified

Point 1) implemented.

r18913 : OGRGeometry::importFromWkt() : allow importing SF-SQL 1.2 style WKT while preserving compatibility with previously recognized non conformant WKT (#3431)

r18914 /trunk/autotest/ogr/ogr_wkbwkt_geom.py: Test importing SF-SQL 1.2 style WKT and robustness to broken WKT (#3431)

Restrictions :

  • even if 'POINT M (x y m)' is recognized, the measure value is still ignored.
  • WKT such as 'MULTILINESTRING(EMPTY,(a b,c d))' can now be imported to conform to the spec, but when exporting to WKT(), the EMPTY parts are skipped (the exportToWkt() has not been modified at all)

No plan for now to implement exportToSF12Wkt() method

comment:3 Changed 10 years ago by Even Rouault

r19208 /trunk/gdal/ogr/ogrmultipolygon.cpp: OGRMultiPolygon::importFromWkt() : more SF 1.2 compliante to support empty linestring text, such as 'MULTIPOLYGON (((0 1,2 3,4 5,0 1),EMPTY))' (#3431)

r19209 /trunk/autotest/ogr/ogr_wkbwkt_geom.py: More tests for importFromWkt() (#3431)

comment:4 Changed 2 years ago by Even Rouault

Resolution: fixed
Status: newclosed

Since GDAL 2 or perhaps even 1.11, we have a OGR_G_ExportToIsoWkt()

Note: See TracTickets for help on using tickets.