PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ lwgeom_is_empty()

int lwgeom_is_empty ( const LWGEOM geom)

Return true or false depending on whether a geometry is an "empty" geometry (no vertices members)

Definition at line 1297 of file lwgeom.c.

References CIRCSTRINGTYPE, COLLECTIONTYPE, COMPOUNDTYPE, CURVEPOLYTYPE, LINETYPE, LW_FALSE, lwcircstring_is_empty(), lwcollection_is_empty(), LWDEBUGF, lwerror(), lwline_is_empty(), lwpoint_is_empty(), lwpoly_is_empty(), lwtriangle_is_empty(), lwtype_name(), MULTICURVETYPE, MULTILINETYPE, MULTIPOINTTYPE, MULTIPOLYGONTYPE, MULTISURFACETYPE, POINTTYPE, POLYGONTYPE, POLYHEDRALSURFACETYPE, TINTYPE, TRIANGLETYPE, LWGEOM::type, and LWCOLLECTION::type.

Referenced by cu_wkb_empty_point_check(), geography_area(), geography_azimuth(), geography_covers(), geography_distance_knn(), geography_distance_uncached(), geography_dwithin_uncached(), geography_length(), geography_perimeter(), geography_project(), geometry_to_path(), geometry_to_point(), geometry_to_polygon(), gserialized_from_lwgeom(), lw_dist2d_recursive(), lw_dist3d_recursive(), lwcollection_build_buffer(), lwcollection_extract(), lwcollection_is_empty(), lwcompound_add_lwgeom(), lwcompound_get_lwpoint(), lwcompound_length_2d(), lwcurvepoly_area(), LWGEOM2GEOS(), LWGEOM2SFCGAL(), lwgeom_add_bbox(), lwgeom_add_bbox_deep(), lwgeom_area_sphere(), lwgeom_area_spheroid(), lwgeom_as_multi(), lwgeom_buildarea(), lwgeom_calculate_circ_tree(), lwgeom_check_geodetic(), lwgeom_clip_by_rect(), lwgeom_clip_to_ordinate_range(), LWGEOM_closestpoint(), LWGEOM_closestpoint3d(), lwgeom_count_rings(), lwgeom_count_vertices(), lwgeom_difference(), lwgeom_distance_spheroid(), LWGEOM_dump(), LWGEOM_dumppoints(), LWGEOM_envelope(), LWGEOM_expand(), LWGEOM_exteriorring_polygon(), lwgeom_homogenize(), LWGEOM_inside_circle_point(), LWGEOM_interiorringn_polygon(), lwgeom_interpolate_point(), lwgeom_intersection(), lwgeom_is_closed(), lwgeom_is_simple(), LWGEOM_isempty(), LWGEOM_length_ellipsoid_linestring(), lwgeom_length_spheroid(), LWGEOM_line_substring(), lwgeom_linemerge(), LWGEOM_longestline2d(), LWGEOM_longestline3d(), LWGEOM_m_point(), lwgeom_nudge_geodetic(), LWGEOM_numgeometries_collection(), lwgeom_remove_repeated_points(), LWGEOM_segmentize2d(), lwgeom_segmentize_sphere(), LWGEOM_setpoint_linestring(), LWGEOM_shortestline2d(), LWGEOM_shortestline3d(), lwgeom_subdivide(), lwgeom_swap_ordinates(), lwgeom_symdifference(), LWGEOM_to_BOX2D(), lwgeom_to_gml2(), lwgeom_to_gml3(), lwgeom_to_kml2(), lwgeom_to_svg(), lwgeom_to_wkb_buf(), lwgeom_to_wkb_size(), lwgeom_transform(), lwgeom_unaryunion(), lwgeom_union(), lwgeom_write_to_buffer(), LWGEOM_x_point(), LWGEOM_y_point(), LWGEOM_z_point(), lwline_from_lwgeom_array(), lwline_from_lwmpoint(), lwline_to_wkb_buf(), lwline_to_wkb_size(), lwmline_locate_along(), lwmline_measured_from_lwmline(), lwmulti_to_twkb_buf(), lwpoint_to_latlon(), lwpoint_to_wkb_buf(), lwpoint_to_wkb_size(), lwpoly_covers_point2d(), lwpoly_to_wkb_buf(), lwpoly_to_wkb_size(), lwt_GetEdgeByPoint(), lwt_GetFaceEdges(), lwtriangle_to_wkb_buf(), lwtriangle_to_wkb_size(), RASTER_asRaster(), RASTER_clip(), RASTER_nearestValue(), RASTER_setPixelValuesGeomval(), ST_CleanGeometry(), ST_CollectionExtract(), ST_OffsetCurve(), test_lwgeom_clip_by_rect(), test_lwgeom_is_empty(), wkt_parser_collection_finalize(), and wkt_parser_compound_new().

1298 {
1299  int result = LW_FALSE;
1300  LWDEBUGF(4, "lwgeom_is_empty: got type %s",
1301  lwtype_name(geom->type));
1302 
1303  switch (geom->type)
1304  {
1305  case POINTTYPE:
1306  return lwpoint_is_empty((LWPOINT*)geom);
1307  break;
1308  case LINETYPE:
1309  return lwline_is_empty((LWLINE*)geom);
1310  break;
1311  case CIRCSTRINGTYPE:
1312  return lwcircstring_is_empty((LWCIRCSTRING*)geom);
1313  break;
1314  case POLYGONTYPE:
1315  return lwpoly_is_empty((LWPOLY*)geom);
1316  break;
1317  case TRIANGLETYPE:
1318  return lwtriangle_is_empty((LWTRIANGLE*)geom);
1319  break;
1320  case MULTIPOINTTYPE:
1321  case MULTILINETYPE:
1322  case MULTIPOLYGONTYPE:
1323  case COMPOUNDTYPE:
1324  case CURVEPOLYTYPE:
1325  case MULTICURVETYPE:
1326  case MULTISURFACETYPE:
1327  case POLYHEDRALSURFACETYPE:
1328  case TINTYPE:
1329  case COLLECTIONTYPE:
1330  return lwcollection_is_empty((LWCOLLECTION *)geom);
1331  break;
1332  default:
1333  lwerror("lwgeom_is_empty: unsupported input geometry type: %s",
1334  lwtype_name(geom->type));
1335  break;
1336  }
1337  return result;
1338 }
#define LINETYPE
Definition: liblwgeom.h:71
#define MULTICURVETYPE
Definition: liblwgeom.h:80
#define POLYGONTYPE
Definition: liblwgeom.h:72
#define CURVEPOLYTYPE
Definition: liblwgeom.h:79
#define COMPOUNDTYPE
Definition: liblwgeom.h:78
#define MULTIPOINTTYPE
Definition: liblwgeom.h:73
#define TRIANGLETYPE
Definition: liblwgeom.h:83
#define POLYHEDRALSURFACETYPE
Definition: liblwgeom.h:82
int lwtriangle_is_empty(const LWTRIANGLE *triangle)
Definition: lwtriangle.c:162
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:188
int lwcollection_is_empty(const LWCOLLECTION *col)
Definition: lwcollection.c:481
#define LW_FALSE
Definition: liblwgeom.h:62
#define TINTYPE
Definition: liblwgeom.h:84
int lwpoly_is_empty(const LWPOLY *poly)
Definition: lwpoly.c:332
int lwcircstring_is_empty(const LWCIRCSTRING *circ)
Definition: lwcircstring.c:263
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:75
int lwline_is_empty(const LWLINE *line)
Definition: lwline.c:496
#define MULTISURFACETYPE
Definition: liblwgeom.h:81
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:70
int lwpoint_is_empty(const LWPOINT *point)
Definition: lwpoint.c:260
uint8_t type
Definition: liblwgeom.h:380
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:77
#define MULTILINETYPE
Definition: liblwgeom.h:74
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:55
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:74
#define COLLECTIONTYPE
Definition: liblwgeom.h:76
Here is the call graph for this function: