PostGIS  2.3.8dev-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 2729 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().

2730 {
2731  if ( lwgeom_is_empty(geom) )
2732  return LW_TRUE;
2733 
2734  switch (geom->type)
2735  {
2736  case POINTTYPE:
2737  return lwpoint_check_geodetic((LWPOINT *)geom);
2738  case LINETYPE:
2739  return lwline_check_geodetic((LWLINE *)geom);
2740  case POLYGONTYPE:
2741  return lwpoly_check_geodetic((LWPOLY *)geom);
2742  case TRIANGLETYPE:
2743  return lwtriangle_check_geodetic((LWTRIANGLE *)geom);
2744  case MULTIPOINTTYPE:
2745  case MULTILINETYPE:
2746  case MULTIPOLYGONTYPE:
2747  case POLYHEDRALSURFACETYPE:
2748  case TINTYPE:
2749  case COLLECTIONTYPE:
2750  return lwcollection_check_geodetic((LWCOLLECTION *)geom);
2751  default:
2752  lwerror("lwgeom_check_geodetic: unsupported input geometry type: %d - %s",
2753  geom->type, lwtype_name(geom->type));
2754  }
2755  return LW_FALSE;
2756 }
#define LINETYPE
Definition: liblwgeom.h:85
#define POLYGONTYPE
Definition: liblwgeom.h:86
#define MULTIPOINTTYPE
Definition: liblwgeom.h:87
#define TRIANGLETYPE
Definition: liblwgeom.h:97
#define POLYHEDRALSURFACETYPE
Definition: liblwgeom.h:96
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:216
#define LW_FALSE
Definition: liblwgeom.h:76
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:75
#define TINTYPE
Definition: liblwgeom.h:98
static int lwline_check_geodetic(const LWLINE *line)
Definition: lwgeodetic.c:2690
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:89
static int lwcollection_check_geodetic(const LWCOLLECTION *col)
Definition: lwgeodetic.c:2716
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:84
static int lwtriangle_check_geodetic(const LWTRIANGLE *triangle)
Definition: lwgeodetic.c:2709
uint8_t type
Definition: liblwgeom.h:395
static int lwpoly_check_geodetic(const LWPOLY *poly)
Definition: lwgeodetic.c:2696
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:1310
static int lwpoint_check_geodetic(const LWPOINT *point)
Definition: lwgeodetic.c:2684
#define MULTILINETYPE
Definition: liblwgeom.h:88
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:102
#define COLLECTIONTYPE
Definition: liblwgeom.h:90
Here is the call graph for this function:
Here is the caller graph for this function: