[postgis-devel] Question about EWKT and Dimension qualifiers

Sandro Santilli strk at kbt.io
Sat Nov 9 02:51:53 PST 2019


On Fri, Nov 08, 2019 at 01:00:20PM +0100, Manuel Jesús Morillo wrote:
> Hi all!
> 
> First of all I would like to say this is my first email in the list since I
> joined OSGeo some days ago so I am sorry if I miss something! :)
> 
> I would like starting to contribute to Postgis and I was taking a look to
> the ticket #4561 <https://trac.osgeo.org/postgis/ticket/4561> when some
> questions came to my mind.
> 
> At this moment the function ST_AsEwkt is missing the ZM for a 3-dimensional
> measured geometry:
> 
> query: SELECT ST_AsEwkt(ST_GeomFromText('POINTZM(10 10 2 3)'));
> expected: POINT ZM (10 10 2 3)
> output: POINT(10 10 2 3)

EWKT stands for Extended Well Known Text, the specification does NOT
want ZM. You can read about EWKT in the doc/ZMSgeoms.txt file, under
section

    2.3. Extensions to Well-Known-Text format

You can read it online at:

   https://trac.osgeo.org/postgis/browser/git/doc/ZMSgeoms.txt#L173

It's a document from 2005, sent as a proposal to OGC for support
of higher-dimension geometries. The proposal was not accepted and
they ended up using the ZM prefix instead, which is why PostGIS
now supports both (and more) output types.

> So if we change "WKT_EXTENDED" to "WKT_EXTENDED | WKT_ISO" in LWGEOM_asEWKT
> / ST_AsEWKT then the SRID and ZM are kept:

I dubt WKT_EXTENDED and WKT_ISO are meant to be used as bitfields, use
either one or the other...

--strk;


More information about the postgis-devel mailing list