PostGIS  3.4.0dev-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 3130 of file lwgeodetic.c.

3131 {
3132  if ( lwgeom_is_empty(geom) )
3133  return LW_TRUE;
3134 
3135  switch (geom->type)
3136  {
3137  case POINTTYPE:
3138  return lwpoint_check_geodetic((LWPOINT *)geom);
3139  case LINETYPE:
3140  return lwline_check_geodetic((LWLINE *)geom);
3141  case POLYGONTYPE:
3142  return lwpoly_check_geodetic((LWPOLY *)geom);
3143  case TRIANGLETYPE:
3144  return lwtriangle_check_geodetic((LWTRIANGLE *)geom);
3145  case MULTIPOINTTYPE:
3146  case MULTILINETYPE:
3147  case MULTIPOLYGONTYPE:
3148  case POLYHEDRALSURFACETYPE:
3149  case TINTYPE:
3150  case COLLECTIONTYPE:
3151  return lwcollection_check_geodetic((LWCOLLECTION *)geom);
3152  default:
3153  lwerror("lwgeom_check_geodetic: unsupported input geometry type: %d - %s",
3154  geom->type, lwtype_name(geom->type));
3155  }
3156  return LW_FALSE;
3157 }
#define LW_FALSE
Definition: liblwgeom.h:94
#define COLLECTIONTYPE
Definition: liblwgeom.h:108
#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 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 TRIANGLETYPE
Definition: liblwgeom.h:115
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:93
static int lwline_check_geodetic(const LWLINE *line)
Definition: lwgeodetic.c:3091
static int lwcollection_check_geodetic(const LWCOLLECTION *col)
Definition: lwgeodetic.c:3117
static int lwpoly_check_geodetic(const LWPOLY *poly)
Definition: lwgeodetic.c:3097
static int lwtriangle_check_geodetic(const LWTRIANGLE *triangle)
Definition: lwgeodetic.c:3110
static int lwpoint_check_geodetic(const LWPOINT *point)
Definition: lwgeodetic.c:3085
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
static int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members)
Definition: lwinline.h:203
uint8_t type
Definition: liblwgeom.h:462

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 LWPOINT::type.

Referenced by lwcollection_check_geodetic(), and test_lwgeom_check_geodetic().

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