PostGIS  2.3.8dev-r@@SVN_REVISION@@

◆ LWGEOM_to_BOX3D()

Datum LWGEOM_to_BOX3D ( PG_FUNCTION_ARGS  )

Definition at line 415 of file lwgeom_box3d.c.

References box3d_from_gbox(), BOX3D_xmin(), LW_FAILURE, lwgeom_calculate_gbox(), lwgeom_free(), lwgeom_from_gserialized(), PG_FUNCTION_INFO_V1(), BOX3D::srid, and LWGEOM::srid.

Referenced by BOX3D_expand().

416 {
417  GSERIALIZED *geom = PG_GETARG_GSERIALIZED_P(0);
418  LWGEOM *lwgeom = lwgeom_from_gserialized(geom);
419  GBOX gbox;
420  BOX3D *result;
421  int rv = lwgeom_calculate_gbox(lwgeom, &gbox);
422 
423  if ( rv == LW_FAILURE )
424  PG_RETURN_NULL();
425 
426  result = box3d_from_gbox(&gbox);
427  result->srid = lwgeom->srid;
428 
429  lwgeom_free(lwgeom);
430  PG_RETURN_POINTER(result);
431 }
int32_t srid
Definition: liblwgeom.h:278
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1063
int32_t srid
Definition: liblwgeom.h:398
#define LW_FAILURE
Definition: liblwgeom.h:78
int lwgeom_calculate_gbox(const LWGEOM *lwgeom, GBOX *gbox)
Calculate bounding box of a geometry, automatically taking into account whether it is cartesian or ge...
Definition: lwgeom.c:665
BOX3D * box3d_from_gbox(const GBOX *gbox)
Definition: g_box.c:64
Here is the call graph for this function:
Here is the caller graph for this function: