PostGIS  3.3.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 2971 of file lwgeodetic.c.

2972 {
2973  if ( lwgeom_is_empty(geom) )
2974  return LW_TRUE;
2975 
2976  switch (geom->type)
2977  {
2978  case POINTTYPE:
2979  return lwpoint_check_geodetic((LWPOINT *)geom);
2980  case LINETYPE:
2981  return lwline_check_geodetic((LWLINE *)geom);
2982  case POLYGONTYPE:
2983  return lwpoly_check_geodetic((LWPOLY *)geom);
2984  case TRIANGLETYPE:
2985  return lwtriangle_check_geodetic((LWTRIANGLE *)geom);
2986  case MULTIPOINTTYPE:
2987  case MULTILINETYPE:
2988  case MULTIPOLYGONTYPE:
2989  case POLYHEDRALSURFACETYPE:
2990  case TINTYPE:
2991  case COLLECTIONTYPE:
2992  return lwcollection_check_geodetic((LWCOLLECTION *)geom);
2993  default:
2994  lwerror("lwgeom_check_geodetic: unsupported input geometry type: %d - %s",
2995  geom->type, lwtype_name(geom->type));
2996  }
2997  return LW_FALSE;
2998 }
#define LW_FALSE
Definition: liblwgeom.h:109
#define COLLECTIONTYPE
Definition: liblwgeom.h:123
#define MULTILINETYPE
Definition: liblwgeom.h:121
#define LINETYPE
Definition: liblwgeom.h:118
#define MULTIPOINTTYPE
Definition: liblwgeom.h:120
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:117
#define TINTYPE
Definition: liblwgeom.h:131
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:122
#define POLYGONTYPE
Definition: liblwgeom.h:119
#define POLYHEDRALSURFACETYPE
Definition: liblwgeom.h:129
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:130
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:108
static int lwline_check_geodetic(const LWLINE *line)
Definition: lwgeodetic.c:2932
static int lwcollection_check_geodetic(const LWCOLLECTION *col)
Definition: lwgeodetic.c:2958
static int lwpoly_check_geodetic(const LWPOLY *poly)
Definition: lwgeodetic.c:2938
static int lwtriangle_check_geodetic(const LWTRIANGLE *triangle)
Definition: lwgeodetic.c:2951
static int lwpoint_check_geodetic(const LWPOINT *point)
Definition: lwgeodetic.c:2926
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:477

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: