PostGIS  2.1.10dev-r@@SVN_REVISION@@
Datum LWGEOM_nrings ( PG_FUNCTION_ARGS  )

Definition at line 226 of file lwgeom_functions_basic.c.

References lwgeom_count_rings(), lwgeom_free(), and lwgeom_from_gserialized().

227 {
228  GSERIALIZED *geom = (GSERIALIZED *)PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
229  LWGEOM *lwgeom = lwgeom_from_gserialized(geom);
230  int nrings = 0;
231 
232  nrings = lwgeom_count_rings(lwgeom);
233  lwgeom_free(lwgeom);
234 
235  PG_FREE_IF_COPY(geom, 0);
236  PG_RETURN_INT32(nrings);
237 }
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1006
LWGEOM * geom
int lwgeom_count_rings(const LWGEOM *geom)
Count the total number of rings in any LWGEOM.
Definition: lwgeom.c:1181

Here is the call graph for this function: