PostGIS  2.3.7dev-r@@SVN_REVISION@@
Datum LWGEOM_dimension ( PG_FUNCTION_ARGS  )

Definition at line 302 of file lwgeom_ogc.c.

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

303 {
304  GSERIALIZED *geom = PG_GETARG_GSERIALIZED_P(0);
305  LWGEOM *lwgeom = lwgeom_from_gserialized(geom);
306  int dimension = -1;
307 
308  dimension = lwgeom_dimension(lwgeom);
309  lwgeom_free(lwgeom);
310  PG_FREE_IF_COPY(geom, 0);
311 
312  if ( dimension < 0 )
313  {
314  elog(NOTICE, "Could not compute geometry dimensions");
315  PG_RETURN_NULL();
316  }
317 
318  PG_RETURN_INT32(dimension);
319 }
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1063
int lwgeom_dimension(const LWGEOM *geom)
For an LWGEOM, returns 0 for points, 1 for lines, 2 for polygons, 3 for volume, and the max dimension...
Definition: lwgeom.c:1205

Here is the call graph for this function: