PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ LWGEOM_dimension()

Datum LWGEOM_dimension ( PG_FUNCTION_ARGS  )

Definition at line 302 of file lwgeom_ogc.c.

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

Referenced by LWGEOM_geometryn_collection().

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:1099
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:1241
Here is the call graph for this function:
Here is the caller graph for this function: