PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ LWGEOM_to_BOX2DF()

Datum LWGEOM_to_BOX2DF ( PG_FUNCTION_ARGS  )

Definition at line 149 of file lwgeom_box.c.

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

Referenced by LWGEOM_to_BOX2D().

150 {
151  GSERIALIZED *geom = PG_GETARG_GSERIALIZED_P(0);
152  GBOX gbox;
153 
154  if ( gserialized_get_gbox_p(geom, &gbox) == LW_FAILURE )
155  PG_RETURN_NULL();
156 
157  /* Strip out higher dimensions */
158  FLAGS_SET_Z(gbox.flags, 0);
159  FLAGS_SET_M(gbox.flags, 0);
160 
161  PG_FREE_IF_COPY(geom, 0);
162  PG_RETURN_POINTER(gbox_copy(&gbox));
163 }
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:642
GBOX * gbox_copy(const GBOX *box)
Return a copy of the GBOX, based on dimensionality of flags.
Definition: g_box.c:438
#define LW_FAILURE
Definition: liblwgeom.h:79
#define FLAGS_SET_Z(flags, value)
Definition: liblwgeom.h:146
uint8_t flags
Definition: liblwgeom.h:291
#define FLAGS_SET_M(flags, value)
Definition: liblwgeom.h:147
Here is the call graph for this function:
Here is the caller graph for this function: