[postgis-tickets] [PostGIS] #5361: Compound Curve inconsistent behavior with ST_GeometryN, ST_NumGeometries, and ST_Dump
PostGIS
trac at osgeo.org
Thu Mar 23 01:49:40 PDT 2023
#5361: Compound Curve inconsistent behavior with ST_GeometryN, ST_NumGeometries,
and ST_Dump
---------------------+---------------------------
Reporter: robe | Owner: pramsey
Type: defect | Status: new
Priority: low | Milestone: PostGIS 3.4.0
Component: postgis | Version: master
Keywords: |
---------------------+---------------------------
Someone asked a question on IRC, which caused me some concern.
How do you get the child types of a compound curve?
I was bothered because of the dichotomy of functions that should agree
with each other that don't
{{{
SELECT ST_Numgeometries(geom), ST_GeometryType(ST_GeometryN(geom,1)),
ST_GeometryN(geom,2)
FROM ST_GeomFromText(
'COMPOUNDCURVE(
(2 2, 2.5 2.5),
CIRCULARSTRING(2.5 2.5, 4.5 2.5, 3.5 3.5),
(3.5 3.5, 2.5 4.5, 3 5)
)') AS f(geom);
}}}
Output is:
{{{
st_numgeometries | st_geometrytype | st_geometryn
------------------+------------------+--------------
3 | ST_CompoundCurve |
(1 row)
}}}
One can argue both sides, that a compoundcurve is no different from a
LINESTRING in that it defines a contiguous line of sorts.
But yet both ST_Numgeometries and ST_Dump do not see it that way
{{{
SELECT gd.path, ST_GeometryType(gd.geom)
FROM ST_GeomFromText(
'COMPOUNDCURVE(
(2 2, 2.5 2.5),
CIRCULARSTRING(2.5 2.5, 4.5 2.5, 3.5 3.5),
(3.5 3.5, 2.5 4.5, 3 5)
)') AS f(geom), ST_Dump(f.geom) AS gd;
}}}
{{{
path | st_geometrytype
------+-------------------
{1} | ST_LineString
{2} | ST_CircularString
{3} | ST_LineString
(3 rows)
}}}
But then if ST_Dump were not flawed in this one, one could not arrive at
the subtypes of a compound curve. What of ST_NumGeometries? Do the specs
say anything about how compound curve sub-elements should be counted.
--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/5361>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.
More information about the postgis-tickets
mailing list