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

Definition at line 211 of file lwgeom_functions_basic.c.

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

212 {
213  GSERIALIZED *geom = (GSERIALIZED *)PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
214  LWGEOM *lwgeom = lwgeom_from_gserialized(geom);
215  int npoints = 0;
216 
217  npoints = lwgeom_count_vertices(lwgeom);
218  lwgeom_free(lwgeom);
219 
220  PG_FREE_IF_COPY(geom, 0);
221  PG_RETURN_INT32(npoints);
222 }
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_vertices(const LWGEOM *geom)
Count the total number of vertices in any LWGEOM.
Definition: lwgeom.c:1072

Here is the call graph for this function: