[postgis-tickets] [PostGIS] #4736: ST_NumGeometries is zero for GeometryCollection with empty parts
PostGIS
trac at osgeo.org
Thu Jul 29 17:26:21 PDT 2021
#4736: ST_NumGeometries is zero for GeometryCollection with empty parts
-------------------------+---------------------------
Reporter: Mike Taves | Owner: strk
Type: defect | Status: closed
Priority: medium | Milestone: PostGIS 3.2.0
Component: postgis | Version: main
Resolution: fixed | Keywords:
-------------------------+---------------------------
Comment (by mdavis):
Replying to [comment:5 pramsey]:
> I'm half-tempted to go with num geometries is 1 for simple objects and n
-sub-geometries for any collection, even a collection of empties, and make
the behaviour consistent. Would require updates to the wiki page, but I
think the angels on the pin dance better that way. Thoughts?
FWIW, that is the semantics that JTS implements. It allows seamless
iteration over atomic and collection geometries, with no special cases.
OGC only defines ST_NumGeometries and ST_GeometryN on GeometryCollection
and subclasses. IMO it's nicer to have functions operate on any geometry
type in a consistent way (especially in a language like SQL, where it's
awkward to handle special cases, and NULL has a semantic slightly
different to EMPTY). This seemed like the right way to extend them to
atomic geometries.
--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/4736#comment:12>
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