Opened 9 months ago

Last modified 9 months ago

#5663 closed defect

ST_GeometryN cannot access sections of CompoundCurve — at Initial Version

Reported by: dbaston Owned by: pramsey
Priority: medium Milestone: PostGIS 3.4.3
Component: postgis Version: 3.4.x
Keywords: Cc:

Description

ST_NumGeometries reports that the following curve has two sub-geometries:

 SELECT ST_NumGeometries('COMPOUNDCURVE (CIRCULARSTRING (0 0, 1 1, 1 0), (1 0, 0 1))'::geometry);
 st_numgeometries 
------------------
                2

However, attempting to access the first section of the curve with ST_GeometryN returns the entire CompoundCurve:

SELECT ST_AsText(ST_GeometryN('COMPOUNDCURVE (CIRCULARSTRING (0 0, 1 1, 1 0), (1 0, 0 1))'::geometry, 1));
                      st_astext                       
------------------------------------------------------
 COMPOUNDCURVE(CIRCULARSTRING(0 0,1 1,1 0),(1 0,0 1))

This behavior differs from OGR:

from osgeo import ogr
g = ogr.CreateGeometryFromWkt('COMPOUNDCURVE (CIRCULARSTRING (0 0, 1 1, 1 0), (1 0, 0 1))')
g.GetGeometryCount()
# 2
g.GetGeometryRef(1).ExportToWkt()
# LINESTRING (1 0,0 1)

Change History (0)

Note: See TracTickets for help on using tickets.