[postgis-devel] Question about EWKT and Dimension qualifiers

Manuel Jesús Morillo mmorillo at carto.com
Fri Nov 8 04:00:20 PST 2019


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)


However, the ST_AsText (WKT ISO) is working as expected:

query: SELECT ST_AsText(ST_GeomFromText('POINTZM(10 10 2 3)'));
expected: POINT ZM (10 10 2 3)
output: POINT ZM (10 10 2 3)


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

query: SELECT ST_AsEwkt(ST_GeomFromEWKT('SRID=100;POINTZM(10 10 2 3)'));
expected: "SRID=100;POINT ZM (10 10 2 3)"
output: "SRID=100;POINT ZM (10 10 2 3)"


But we should change other tests tests which are failing with these
changes, e.g.:

CU_ASSERT_STRING_EQUAL(cu_wkt("POINT(0 0 0 0)",WKT_EXTENDED),"POINT(0 0 0
0)")

we should change it to:

CU_ASSERT_STRING_EQUAL(cu_wkt("POINT(0 0 0 0)",WKT_EXTENDED),"POINT ZM (0 0
0 0)")


According to this doc
<https://github.com/postgis/postgis/blob/master/doc/ZMSgeoms.txt>
the ST_AsEwkt function should omit the Z qualifier but in my opinion it
should have the same behaviour than WKT ISO in those cases.

What do you think?

Best.

-- 
Manuel Jesús Morillo

Software Engineer

+1 917 463 3232 | mmorillo at carto.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20191108/26b96f84/attachment.html>


More information about the postgis-devel mailing list