[postgis-devel] Question about EWKT and Dimension qualifiers
rmrodriguez at carto.com
rmrodriguez at carto.com
Fri Nov 8 04:59:43 PST 2019
My thoughts about this:
Let's start by saying that changing ST_AsEWKT from `WKT_EXTENDED` to
`WKT_EXTENDED | WKT_ISO` should be enough to address #4561, but as
observed quite a bit of tests expect its output to not include `Z`,
`M` or `ZM` so I wouldn't consider this a bug but an improvement.
Having said that, now I want to backtrack and think about whether
we want to address #4561 or not, since doing it involves a breaking
change. First thing I see is that, even though ST_AsEWKT does not
include the full dimension qualifiers, the dimension information
isn't lost:
```
template_postgis=# Select ST_AsEWKT('SRID=4326; POINT Z (0 0 0)');
st_asewkt
------------------------
SRID=4326;POINT(0 0 0)
(1 row)
template_postgis=# Select ST_AsEWKT('SRID=4326; POINT M (0 0 0)');
st_asewkt
-------------------------
SRID=4326;POINTM(0 0 0)
(1 row)
template_postgis=# Select ST_AsEWKT('SRID=4326; POINT ZM (0 0 0 0)');
st_asewkt
--------------------------
SRID=4326;POINT(0 0 0 0)
(1 row)
```
But it isn't different to what I expected before looking at the code,
which was ST_AsText + SRID information:
```
template_postgis=# Select ST_AsText('SRID=4326; POINT Z (0 0 0)');
st_astext
-----------------
POINT Z (0 0 0)
(1 row)
template_postgis=# Select ST_AsText('SRID=4326; POINT M (0 0 0)');
st_astext
-----------------
POINT M (0 0 0)
(1 row)
template_postgis=# Select ST_AsText('SRID=4326; POINT ZM (0 0 0 0)');
st_astext
--------------------
POINT ZM (0 0 0 0)
(1 row)
```
So I see 1 necessary change:
- Document clearly in ST_AsEWKT that the output doesn't follow WKT_ISO.
And 1 optional change:
- Change the behaviour of ST_AsEWKT in 3.1+ to follow ST_AsText footsteps
and include the dimension qualifiers at all times, thus making a breaking
change.
To be honest, if ST_AsEWKT has lived all this time without complains I don't
think breaking a lot of tests is really worth it and just documenting the
behaviour more clearly should be enough, but I'd like to hear what's the
opinion of the "older generation" :D.
Regards
--
Raúl Marín Rodríguez
carto.com
More information about the postgis-devel
mailing list