PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ lwgeom_calculate_gbox_geodetic()

int lwgeom_calculate_gbox_geodetic ( const LWGEOM geom,
GBOX gbox 
)

Calculate the geodetic bounding box for an LWGEOM.

Z/M coordinates are ignored for this calculation. Pass in non-null, geodetic bounding box for function to fill out. LWGEOM must have been built from a GSERIALIZED to provide double aligned point arrays.

Definition at line 3012 of file lwgeodetic.c.

References COLLECTIONTYPE, GBOX::flags, LWGEOM::flags, FLAGS_GET_M, FLAGS_GET_Z, gflags(), LINETYPE, LW_FAILURE, lwcollection_calculate_gbox_geodetic(), LWDEBUGF, lwerror(), lwline_calculate_gbox_geodetic(), lwpoint_calculate_gbox_geodetic(), lwpolygon_calculate_gbox_geodetic(), lwtriangle_calculate_gbox_geodetic(), lwtype_name(), MULTILINETYPE, MULTIPOINTTYPE, MULTIPOLYGONTYPE, POINTTYPE, POLYGONTYPE, POLYHEDRALSURFACETYPE, TINTYPE, TRIANGLETYPE, LWGEOM::type, and LWCOLLECTION::type.

Referenced by CircTreePIP(), geography_area(), lwcollection_calculate_gbox_geodetic(), lwgeom_calculate_gbox(), lwgeom_covers_lwgeom_sphere(), lwgeom_distance_spheroid(), lwpoly_covers_point2d(), lwpoly_pt_outside(), test_gbox_from_spherical_coordinates(), test_gbox_utils(), test_spheroid_area(), and test_tree_circ_pip2().

3013 {
3014  int result = LW_FAILURE;
3015  LWDEBUGF(4, "got type %d", geom->type);
3016 
3017  /* Add a geodetic flag to the incoming gbox */
3018  gbox->flags = gflags(FLAGS_GET_Z(geom->flags),FLAGS_GET_M(geom->flags),1);
3019 
3020  switch (geom->type)
3021  {
3022  case POINTTYPE:
3023  result = lwpoint_calculate_gbox_geodetic((LWPOINT*)geom, gbox);
3024  break;
3025  case LINETYPE:
3026  result = lwline_calculate_gbox_geodetic((LWLINE *)geom, gbox);
3027  break;
3028  case POLYGONTYPE:
3029  result = lwpolygon_calculate_gbox_geodetic((LWPOLY *)geom, gbox);
3030  break;
3031  case TRIANGLETYPE:
3032  result = lwtriangle_calculate_gbox_geodetic((LWTRIANGLE *)geom, gbox);
3033  break;
3034  case MULTIPOINTTYPE:
3035  case MULTILINETYPE:
3036  case MULTIPOLYGONTYPE:
3037  case POLYHEDRALSURFACETYPE:
3038  case TINTYPE:
3039  case COLLECTIONTYPE:
3040  result = lwcollection_calculate_gbox_geodetic((LWCOLLECTION *)geom, gbox);
3041  break;
3042  default:
3043  lwerror("lwgeom_calculate_gbox_geodetic: unsupported input geometry type: %d - %s",
3044  geom->type, lwtype_name(geom->type));
3045  break;
3046  }
3047  return result;
3048 }
#define LINETYPE
Definition: liblwgeom.h:86
static int lwtriangle_calculate_gbox_geodetic(const LWTRIANGLE *triangle, GBOX *gbox)
Definition: lwgeodetic.c:2970
#define POLYGONTYPE
Definition: liblwgeom.h:87
uint8_t flags
Definition: liblwgeom.h:397
#define MULTIPOINTTYPE
Definition: liblwgeom.h:88
#define TRIANGLETYPE
Definition: liblwgeom.h:98
#define POLYHEDRALSURFACETYPE
Definition: liblwgeom.h:97
static int lwline_calculate_gbox_geodetic(const LWLINE *line, GBOX *gbox)
Definition: lwgeodetic.c:2934
#define LW_FAILURE
Definition: liblwgeom.h:79
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:218
#define TINTYPE
Definition: liblwgeom.h:99
static int lwpoint_calculate_gbox_geodetic(const LWPOINT *point, GBOX *gbox)
Definition: lwgeodetic.c:2928
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:140
static int lwpolygon_calculate_gbox_geodetic(const LWPOLY *poly, GBOX *gbox)
Definition: lwgeodetic.c:2940
uint8_t flags
Definition: liblwgeom.h:291
uint8_t gflags(int hasz, int hasm, int geodetic)
Construct a new flags char.
Definition: g_util.c:145
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:90
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:85
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:141
uint8_t type
Definition: liblwgeom.h:396
#define MULTILINETYPE
Definition: liblwgeom.h:89
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
static int lwcollection_calculate_gbox_geodetic(const LWCOLLECTION *coll, GBOX *gbox)
Definition: lwgeodetic.c:2977
#define COLLECTIONTYPE
Definition: liblwgeom.h:91
Here is the call graph for this function:
Here is the caller graph for this function: