PostGIS  2.5.0dev-r@@SVN_REVISION@@
Datum LWGEOM_to_BOX2DF ( PG_FUNCTION_ARGS  )

Definition at line 141 of file lwgeom_box.c.

References GBOX::flags, FLAGS_SET_M, FLAGS_SET_Z, gbox_copy(), gserialized_get_gbox_p(), and LW_FAILURE.

142 {
143  GSERIALIZED *geom = PG_GETARG_GSERIALIZED_P(0);
144  GBOX gbox;
145 
146  if ( gserialized_get_gbox_p(geom, &gbox) == LW_FAILURE )
147  PG_RETURN_NULL();
148 
149  /* Strip out higher dimensions */
150  FLAGS_SET_Z(gbox.flags, 0);
151  FLAGS_SET_M(gbox.flags, 0);
152 
153  PG_FREE_IF_COPY(geom, 0);
154  PG_RETURN_POINTER(gbox_copy(&gbox));
155 }
int gserialized_get_gbox_p(const GSERIALIZED *g, GBOX *box)
Read the bounding box off a serialization and calculate one if it is not already there.
Definition: g_serialized.c:639
GBOX * gbox_copy(const GBOX *box)
Return a copy of the GBOX, based on dimensionality of flags.
Definition: g_box.c:433
#define LW_FAILURE
Definition: liblwgeom.h:78
#define FLAGS_SET_Z(flags, value)
Definition: liblwgeom.h:145
uint8_t flags
Definition: liblwgeom.h:290
#define FLAGS_SET_M(flags, value)
Definition: liblwgeom.h:146

Here is the call graph for this function: