PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ LWGEOM_dimension()

Datum LWGEOM_dimension ( PG_FUNCTION_ARGS  )

Definition at line 303 of file lwgeom_ogc.c.

304 {
305  GSERIALIZED *geom = PG_GETARG_GSERIALIZED_P(0);
306  LWGEOM *lwgeom = lwgeom_from_gserialized(geom);
307  int dimension = -1;
308 
309  dimension = lwgeom_dimension(lwgeom);
310  lwgeom_free(lwgeom);
311  PG_FREE_IF_COPY(geom, 0);
312 
313  if ( dimension < 0 )
314  {
315  elog(NOTICE, "Could not compute geometry dimensions");
316  PG_RETURN_NULL();
317  }
318 
319  PG_RETURN_INT32(dimension);
320 }
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1144
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:1287

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

Here is the call graph for this function: