Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#4561 closed defect (invalid)

ST_AsEWKT excluding Z and M in WKT representation

Reported by: tilt Owned by: pramsey
Priority: low Milestone: PostGIS 3.0.1
Component: postgis Version: 3.0.x
Keywords: Cc:

Description

Compare:

SELECT ST_AsText(ST_GeomFromText('POINT ZM(10 10 2 3)'));
$ POINT ZM (10 10 2 3)

to:

SELECT ST_AsEwkt(ST_GeomFromText('POINT ZM(10 10 2 3)'));
$ POINT(10 10 2 3)

This seems inconsistent as I would expect the WKT representation to be the same.

On a side note: the postgis manual states for AsEWKT: This function supports 3d and will not drop the z-index. but is lacking that information for the AsText.

Change History (4)

comment:1 by pramsey, 5 years ago

Resolution: invalid
Status: newclosed

The documentation can be updated, the ST_AsText() documentation probably dates to pre-2.0, when ST_AsText() returned only OGC-standard (2d only) WKT.

The function is doing exactly what it is supposed to, which is returning the EWKT format, which is not the same as ISO format for higher dimensions. There is no bug here.

comment:2 by strk, 5 years ago

Background about "Extended WKT" can be found here: https://trac.osgeo.org/postgis/browser/git/doc/ZMSgeoms.txt

comment:3 by tilt, 5 years ago

OK, makes sense. I see now why this is in the documentation:

PostGIS extended formats are currently superset of OGC one (every valid WKB/WKT is a valid EWKB/EWKT) but this might vary in the future, specifically if OGC comes out with a new format conflicting with our extensions. Thus you SHOULD NOT rely on this feature'' https://postgis.net/docs/using_postgis_dbmanagement.html#EWKB_EWKT

Having multiple representations that appear to mimic each other but are differentiating on trivial points is confusing though. Shouldn't the ZMSgeoms start converging again to the WKT specs? Only reason to keep them currently is the inclusion of the SRS, right?

comment:4 by strk, 5 years ago

Shouldn't the ZMSgeoms start converging again to the WKT specs?

Specs are meant to be references, changes to them are not to be allowed. Rather, you'd end up with a _new_ reference (like a new version of the spec) while still needing to support to old one.

Only reason to keep them currently is the inclusion of the SRS, right?

And backward compatibility.

—strk;

Note: See TracTickets for help on using tickets.