Curve Thoughts

Regina Obe lr at pcorp.us
Fri Feb 16 14:29:50 PST 2024


> > On Feb 16, 2024, at 1:38 PM, Regina Obe <lr at pcorp.us> wrote:
> >
> > ST_GeometryN(<>, 4)
> > Should return the 4th record that ST_Dump returns.
> 
> 
> Worth noting: this is not possible. ST_Dump recurses into collections,
whereas
> geometryN only lets you pick from elements of the top-most collection.
> 
> P

Okay I'll be content with  ST_NumGeometries and ST_GeometryN agreeing

I'm okay with treating Compoundcurve and CurvePolygon as collections as you
propose here

  https://gist.github.com/pramsey/cbf6db1edb8762854925f6b6ad6d6b35

Since the unitary paths sounds painful both in changes and backward
compatibility to perhaps not be worth the effort.

I'm a little confused by this though

https://gist.github.com/pramsey/cbf6db1edb8762854925f6b6ad6d6b35#proposal-fo
r-curvepolygon

if you are treating a curved polygon like below as a collection?

CURVEPOLYGON(COMPOUNDCURVE(
    LINESTRING(2 2, 2.5 2.5),
    CIRCULARSTRING(2.5 2.5, 4.5 2.5, 3.5 3.5),
    LINESTRING(3.5 3.5, 2.5 4.5, 3 5, 2 2)),
    LINESTRING(4 4, 4 5, 5 4, 4 4)
    )

As a collection, how do you end up with this:

ST_GeometryType(ST_Dump(geom).geom) => ST_CurvePolygon

Shouldn't the answer be the same as it currently is with:

SELECT dp.path, ST_GeometryType(geom)
FROM ST_Dump('CURVEPOLYGON(COMPOUNDCURVE(
    LINESTRING(2 2, 2.5 2.5),
    CIRCULARSTRING(2.5 2.5, 4.5 2.5, 3.5 3.5),
    LINESTRING(3.5 3.5, 2.5 4.5, 3 5, 2 2)),
    LINESTRING(4 4, 4 5, 5 4, 4 4)
    )'::geometry) AS dp;


path  |  st_geometrytype
-------+-------------------
 {1,1} | ST_LineString
 {1,2} | ST_CircularString
 {1,3} | ST_LineString
 {2}   | ST_LineString
(4 rows)

e.g. just like in a geometrycollection, a multipolygon or a polyhedral
surface, the outer type no longer exists






More information about the postgis-devel mailing list