PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ LWGEOM_dimension()

Datum LWGEOM_dimension ( PG_FUNCTION_ARGS  )

Definition at line 288 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().

289 {
290  GSERIALIZED *geom = PG_GETARG_GSERIALIZED_P(0);
291  LWGEOM *lwgeom = lwgeom_from_gserialized(geom);
292  int dimension = -1;
293 
294  dimension = lwgeom_dimension(lwgeom);
295  lwgeom_free(lwgeom);
296  PG_FREE_IF_COPY(geom, 0);
297 
298  if ( dimension < 0 )
299  {
300  elog(NOTICE, "Could not compute geometry dimensions");
301  PG_RETURN_NULL();
302  }
303 
304  PG_RETURN_INT32(dimension);
305 }
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1050
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:1192
Here is the call graph for this function:
Here is the caller graph for this function: