PostGIS  2.1.10dev-r@@SVN_REVISION@@
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 2715 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, and LWGEOM::type.

Referenced by lwcollection_check_geodetic(), and test_lwgeom_check_geodetic().

2716 {
2717  if ( lwgeom_is_empty(geom) )
2718  return LW_TRUE;
2719 
2720  switch (geom->type)
2721  {
2722  case POINTTYPE:
2723  return lwpoint_check_geodetic((LWPOINT *)geom);
2724  case LINETYPE:
2725  return lwline_check_geodetic((LWLINE *)geom);
2726  case POLYGONTYPE:
2727  return lwpoly_check_geodetic((LWPOLY *)geom);
2728  case TRIANGLETYPE:
2729  return lwtriangle_check_geodetic((LWTRIANGLE *)geom);
2730  case MULTIPOINTTYPE:
2731  case MULTILINETYPE:
2732  case MULTIPOLYGONTYPE:
2733  case POLYHEDRALSURFACETYPE:
2734  case TINTYPE:
2735  case COLLECTIONTYPE:
2736  return lwcollection_check_geodetic((LWCOLLECTION *)geom);
2737  default:
2738  lwerror("lwgeom_check_geodetic: unsupported input geometry type: %d - %s",
2739  geom->type, lwtype_name(geom->type));
2740  }
2741  return LW_FALSE;
2742 }
#define LINETYPE
Definition: liblwgeom.h:61
#define POLYGONTYPE
Definition: liblwgeom.h:62
#define MULTIPOINTTYPE
Definition: liblwgeom.h:63
#define TRIANGLETYPE
Definition: liblwgeom.h:73
#define POLYHEDRALSURFACETYPE
Definition: liblwgeom.h:72
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:67
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:164
#define LW_FALSE
Definition: liblwgeom.h:52
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:51
#define TINTYPE
Definition: liblwgeom.h:74
static int lwline_check_geodetic(const LWLINE *line)
Definition: lwgeodetic.c:2676
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:65
static int lwcollection_check_geodetic(const LWCOLLECTION *col)
Definition: lwgeodetic.c:2702
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:60
static int lwtriangle_check_geodetic(const LWTRIANGLE *triangle)
Definition: lwgeodetic.c:2695
uint8_t type
Definition: liblwgeom.h:352
static int lwpoly_check_geodetic(const LWPOLY *poly)
Definition: lwgeodetic.c:2682
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:1229
static int lwpoint_check_geodetic(const LWPOINT *point)
Definition: lwgeodetic.c:2670
#define MULTILINETYPE
Definition: liblwgeom.h:64
#define COLLECTIONTYPE
Definition: liblwgeom.h:66

Here is the call graph for this function:

Here is the caller graph for this function: