[postgis-tickets] [PostGIS] #4736: ST_NumGeometries is zero for GeometryCollection with empty parts
PostGIS
trac at osgeo.org
Thu Jul 29 13:51:20 PDT 2021
#4736: ST_NumGeometries is zero for GeometryCollection with empty parts
-------------------------+---------------------------
Reporter: Mike Taves | Owner: strk
Type: defect | Status: assigned
Priority: medium | Milestone: PostGIS 3.0.4
Component: postgis | Version: 2.4.x
Resolution: | Keywords:
-------------------------+---------------------------
Comment (by pramsey):
Hm, the wiki says that ST_GeometryN(empty, 1) should return empty, but
that is a bit fiddly, since ST_NumGeometries(empty) returns 0, which maybe
it should return 1? Since there's one geometry there, and it's an empty
one?
{{{
postgis_reg=# select st_numgeometries('POINT EMPTY');
st_numgeometries
------------------
0
(1 row)
postgis_reg=# select st_numgeometries('POINT(1 1)');
st_numgeometries
------------------
1
(1 row)
}}}
Also, this is inconsistent with num geometries for empty being zero
{{{
postgis_reg=# select st_geometryn('POINT EMPTY', 1);
st_geometryn
--------------------------------------------
0101000000000000000000F87F000000000000F87F
(1 row)
}}}
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?
--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/4736#comment:5>
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