WKT of Empty Shape returns zero-length string rather than standard syntax for Empty geometry

Description

The standard SQL/MM WKT syntax for an empty geometry would be something like "POINT EMPTY" or "LINESTRING EMPTY". However, MapWinGIS returns a zero-length string for an empty geometry, which will generally be rejected by an OGR Datasource since it does not conform to the SQL/MM standard (for example, when used in the ST_GeomFromText() function).

MapWinGIS uses GDAL to format WKT, and GDAL is capable of returning a properly formatted empty WKT. The problem arises because the Shape must be converted into an OGRGeometry prior to calling GDAL, and our code does not properly convert an empty Shape into an empty OGRGeometry - instead it returns NULL.

An empty Shape should be converted into an empty OGR Geometry so that we can get a properly formatted empty WKT.

Activity

Show:
Jerry Faust
March 17, 2020, 2:02 AM

I’ve submitted changes in the OgrConverter.cpp file, effectively pre-creating the OGRGeometry types, but leaving them empty if no points exist in the incoming geometry. This results in the proper WKT syntax, for example, “POINT EMPTY” or “POLYGON EMPTY”.

I’ve also submitted a new unit test that goes through the standard Shapefile Geometry types, verifying that the result is not an empty string, and in fact contains the text “EMPTY”.

Assignee

Jerry Faust

Reporter

Jerry Faust

Labels

None

Epic Link

None

Affects versions

None

Fix versions

Priority

Medium
Configure