PostGIS  3.7.0dev-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 2876 of file lwgeodetic.c.

2877 {
2878  int result = LW_FAILURE;
2879  LWDEBUGF(4, "got type %d", geom->type);
2880 
2881  /* Add a geodetic flag to the incoming gbox */
2882  gbox->flags = lwflags(FLAGS_GET_Z(geom->flags),FLAGS_GET_M(geom->flags),1);
2883 
2884  switch (geom->type)
2885  {
2886  case POINTTYPE:
2888  break;
2889  case LINETYPE:
2890  result = lwline_calculate_gbox_geodetic((LWLINE *)geom, gbox);
2891  break;
2892  case POLYGONTYPE:
2894  break;
2895  case TRIANGLETYPE:
2897  break;
2898  case MULTIPOINTTYPE:
2899  case MULTILINETYPE:
2900  case MULTIPOLYGONTYPE:
2901  case POLYHEDRALSURFACETYPE:
2902  case TINTYPE:
2903  case COLLECTIONTYPE:
2905  break;
2906  default:
2907  lwerror("lwgeom_calculate_gbox_geodetic: unsupported input geometry type: %d - %s",
2908  geom->type, lwtype_name(geom->type));
2909  break;
2910  }
2911  return result;
2912 }
char result[OUT_DOUBLE_BUFFER_SIZE]
Definition: cu_print.c:267
#define COLLECTIONTYPE
Definition: liblwgeom.h:108
#define LW_FAILURE
Definition: liblwgeom.h:96
#define MULTILINETYPE
Definition: liblwgeom.h:106
#define LINETYPE
Definition: liblwgeom.h:103
#define MULTIPOINTTYPE
Definition: liblwgeom.h:105
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:102
#define FLAGS_GET_Z(flags)
Definition: liblwgeom.h:165
#define TINTYPE
Definition: liblwgeom.h:116
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:107
#define POLYGONTYPE
Definition: liblwgeom.h:104
#define POLYHEDRALSURFACETYPE
Definition: liblwgeom.h:114
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:216
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:166
#define TRIANGLETYPE
Definition: liblwgeom.h:115
lwflags_t lwflags(int hasz, int hasm, int geodetic)
Construct a new flags bitmask.
Definition: lwutil.c:477
static int lwcollection_calculate_gbox_geodetic(const LWCOLLECTION *coll, GBOX *gbox)
Definition: lwgeodetic.c:2841
static int lwline_calculate_gbox_geodetic(const LWLINE *line, GBOX *gbox)
Definition: lwgeodetic.c:2798
static int lwtriangle_calculate_gbox_geodetic(const LWTRIANGLE *triangle, GBOX *gbox)
Definition: lwgeodetic.c:2834
static int lwpoint_calculate_gbox_geodetic(const LWPOINT *point, GBOX *gbox)
Definition: lwgeodetic.c:2792
static int lwpolygon_calculate_gbox_geodetic(const LWPOLY *poly, GBOX *gbox)
Definition: lwgeodetic.c:2804
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:106
void void lwerror(const char *fmt,...) __attribute__((format(printf
Write a notice out to the error handler.
lwflags_t flags
Definition: liblwgeom.h:353
uint8_t type
Definition: liblwgeom.h:462
lwflags_t flags
Definition: liblwgeom.h:461

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

Referenced by BOX3D_BOXLL_TEST(), 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().

Here is the call graph for this function:
Here is the caller graph for this function: