[postgis-devel] [PostGIS] #548: st_numgeometries(geom) returns NULL when geom is not multi
PostGIS
trac at osgeo.org
Thu Jul 1 01:26:21 PDT 2010
#548: st_numgeometries(geom) returns NULL when geom is not multi
----------------------+-----------------------------------------------------
Reporter: giohappy | Owner: pramsey
Type: defect | Status: new
Priority: medium | Milestone: PostGIS 1.5.2
Component: postgis | Version: 1.5.X
Keywords: |
----------------------+-----------------------------------------------------
Comment(by robe):
Giohappy,
I know it sounds stupid, but this is by design. The ST_Numgeometries is
designed to only work with multi geometries. I think it was dictated by
the OGC spec, though I would like it to as you say do the logic thing of
returning 1 for single geometries.
The workaround is to wrap your geom in ST_Multi. That will put it into a
multi geometry casing if it is not a multigeometry and do nothing if it
is.
Alternatively just use ST_Dump instead. ST_Dump is faster anyway and will
explode out even for very nested collections.
http://www.postgis.org/documentation/manual-1.5/ST_Dump.html
--
Ticket URL: <http://trac.osgeo.org/postgis/ticket/548#comment:1>
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-devel
mailing list