PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ lwgeom_check_geodetic()

int lwgeom_check_geodetic ( const LWGEOM geom)

Check that coordinates of LWGEOM are all within the geodetic range (-180, -90, 180, 90)

Definition at line 3115 of file lwgeodetic.c.

References COLLECTIONTYPE, LINETYPE, LW_FALSE, LW_TRUE, lwcollection_check_geodetic(), lwerror(), lwgeom_is_empty(), lwline_check_geodetic(), lwpoint_check_geodetic(), lwpoly_check_geodetic(), lwtriangle_check_geodetic(), lwtype_name(), MULTILINETYPE, MULTIPOINTTYPE, MULTIPOLYGONTYPE, POINTTYPE, POLYGONTYPE, POLYHEDRALSURFACETYPE, TINTYPE, TRIANGLETYPE, LWGEOM::type, and LWCOLLECTION::type.

Referenced by lwcollection_check_geodetic(), and test_lwgeom_check_geodetic().

3116 {
3117  if ( lwgeom_is_empty(geom) )
3118  return LW_TRUE;
3119 
3120  switch (geom->type)
3121  {
3122  case POINTTYPE:
3123  return lwpoint_check_geodetic((LWPOINT *)geom);
3124  case LINETYPE:
3125  return lwline_check_geodetic((LWLINE *)geom);
3126  case POLYGONTYPE:
3127  return lwpoly_check_geodetic((LWPOLY *)geom);
3128  case TRIANGLETYPE:
3129  return lwtriangle_check_geodetic((LWTRIANGLE *)geom);
3130  case MULTIPOINTTYPE:
3131  case MULTILINETYPE:
3132  case MULTIPOLYGONTYPE:
3133  case POLYHEDRALSURFACETYPE:
3134  case TINTYPE:
3135  case COLLECTIONTYPE:
3136  return lwcollection_check_geodetic((LWCOLLECTION *)geom);
3137  default:
3138  lwerror("lwgeom_check_geodetic: unsupported input geometry type: %d - %s",
3139  geom->type, lwtype_name(geom->type));
3140  }
3141  return LW_FALSE;
3142 }
#define LINETYPE
Definition: liblwgeom.h:86
#define POLYGONTYPE
Definition: liblwgeom.h:87
#define MULTIPOINTTYPE
Definition: liblwgeom.h:88
#define TRIANGLETYPE
Definition: liblwgeom.h:98
#define POLYHEDRALSURFACETYPE
Definition: liblwgeom.h:97
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:218
#define LW_FALSE
Definition: liblwgeom.h:77
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:76
#define TINTYPE
Definition: liblwgeom.h:99
static int lwline_check_geodetic(const LWLINE *line)
Definition: lwgeodetic.c:3076
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:90
static int lwcollection_check_geodetic(const LWCOLLECTION *col)
Definition: lwgeodetic.c:3102
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:85
static int lwtriangle_check_geodetic(const LWTRIANGLE *triangle)
Definition: lwgeodetic.c:3095
uint8_t type
Definition: liblwgeom.h:396
static int lwpoly_check_geodetic(const LWPOLY *poly)
Definition: lwgeodetic.c:3082
int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members) ...
Definition: lwgeom.c:1346
static int lwpoint_check_geodetic(const LWPOINT *point)
Definition: lwgeodetic.c:3070
#define MULTILINETYPE
Definition: liblwgeom.h:89
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
#define COLLECTIONTYPE
Definition: liblwgeom.h:91
Here is the call graph for this function:
Here is the caller graph for this function: