PostGIS 3.0.6dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ LWGEOM_numgeometries_collection()

Datum LWGEOM_numgeometries_collection ( PG_FUNCTION_ARGS  )

Definition at line 236 of file lwgeom_ogc.c.

237{
238 GSERIALIZED *geom = PG_GETARG_GSERIALIZED_P(0);
239 LWGEOM *lwgeom;
240 int32 ret = 1;
241
242 lwgeom = lwgeom_from_gserialized(geom);
243 if ( lwgeom_is_empty(lwgeom) )
244 {
245 ret = 0;
246 }
247 else if ( lwgeom_is_collection(lwgeom) )
248 {
250 ret = col->ngeoms;
251 }
252 lwgeom_free(lwgeom);
253 PG_FREE_IF_COPY(geom, 0);
254 PG_RETURN_INT32(ret);
255}
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_free(LWGEOM *geom)
Definition lwgeom.c:1138
LWCOLLECTION * lwgeom_as_lwcollection(const LWGEOM *lwgeom)
Definition lwgeom.c:215
int lwgeom_is_collection(const LWGEOM *lwgeom)
Determine whether a LWGEOM can contain sub-geometries or not.
Definition lwgeom.c:1079
static int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members)
Definition lwinline.h:193
unsigned int int32
Definition shpopen.c:273
uint32_t ngeoms
Definition liblwgeom.h:566

References lwgeom_as_lwcollection(), lwgeom_free(), lwgeom_from_gserialized(), lwgeom_is_collection(), lwgeom_is_empty(), and LWCOLLECTION::ngeoms.

Here is the call graph for this function: