PostGIS  2.4.9dev-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 1346 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 add_lwgeom_to_stack(), cu_wkb_empty_point_check(), do_median_test(), 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(), geos_envelope_surrogate(), 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_calculate_mbc(), lwgeom_centroid(), lwgeom_check_geodetic(), lwgeom_clip_by_rect(), lwgeom_clip_to_ordinate_range(), LWGEOM_closestpoint(), LWGEOM_closestpoint3d(), lwgeom_cluster_2d_kmeans(), 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_numinteriorrings_polygon(), lwgeom_remove_repeated_points(), LWGEOM_segmentize2d(), lwgeom_segmentize_sphere(), 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_to_x3d3(), lwgeom_transform(), lwgeom_unaryunion(), lwgeom_union(), lwgeom_wrapx(), 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(), lwmpoint_extract_points_3d(), lwmpoly_to_points(), lwmulti_to_twkb_buf(), lwpoint_to_latlon(), lwpoint_to_wkb_buf(), lwpoint_to_wkb_size(), lwpoly_covers_lwline(), lwpoly_covers_lwpoly(), lwpoly_covers_point2d(), lwpoly_pt_outside_hack(), lwpoly_to_points(), lwpoly_to_wkb_buf(), lwpoly_to_wkb_size(), lwt_GetEdgeByPoint(), lwt_GetFaceEdges(), lwtriangle_to_wkb_buf(), lwtriangle_to_wkb_size(), mvt_geom(), RASTER_asRaster(), RASTER_clip(), RASTER_nearestValue(), RASTER_setPixelValuesGeomval(), ShpLoaderGenerateShapeRow(), ST_CleanGeometry(), ST_CollectionExtract(), ST_OffsetCurve(), test_lwgeom_clip_by_rect(), test_lwgeom_is_empty(), union_dbscan_general(), union_dbscan_minpoints_1(), wkt_parser_collection_finalize(), and wkt_parser_compound_new().

1347 {
1348  int result = LW_FALSE;
1349  LWDEBUGF(4, "lwgeom_is_empty: got type %s",
1350  lwtype_name(geom->type));
1351 
1352  switch (geom->type)
1353  {
1354  case POINTTYPE:
1355  return lwpoint_is_empty((LWPOINT*)geom);
1356  break;
1357  case LINETYPE:
1358  return lwline_is_empty((LWLINE*)geom);
1359  break;
1360  case CIRCSTRINGTYPE:
1361  return lwcircstring_is_empty((LWCIRCSTRING*)geom);
1362  break;
1363  case POLYGONTYPE:
1364  return lwpoly_is_empty((LWPOLY*)geom);
1365  break;
1366  case TRIANGLETYPE:
1367  return lwtriangle_is_empty((LWTRIANGLE*)geom);
1368  break;
1369  case MULTIPOINTTYPE:
1370  case MULTILINETYPE:
1371  case MULTIPOLYGONTYPE:
1372  case COMPOUNDTYPE:
1373  case CURVEPOLYTYPE:
1374  case MULTICURVETYPE:
1375  case MULTISURFACETYPE:
1376  case POLYHEDRALSURFACETYPE:
1377  case TINTYPE:
1378  case COLLECTIONTYPE:
1379  return lwcollection_is_empty((LWCOLLECTION *)geom);
1380  break;
1381  default:
1382  lwerror("lwgeom_is_empty: unsupported input geometry type: %s",
1383  lwtype_name(geom->type));
1384  break;
1385  }
1386  return result;
1387 }
#define LINETYPE
Definition: liblwgeom.h:86
#define MULTICURVETYPE
Definition: liblwgeom.h:95
#define POLYGONTYPE
Definition: liblwgeom.h:87
#define CURVEPOLYTYPE
Definition: liblwgeom.h:94
#define COMPOUNDTYPE
Definition: liblwgeom.h:93
#define MULTIPOINTTYPE
Definition: liblwgeom.h:88
#define TRIANGLETYPE
Definition: liblwgeom.h:98
#define POLYHEDRALSURFACETYPE
Definition: liblwgeom.h:97
int lwtriangle_is_empty(const LWTRIANGLE *triangle)
Definition: lwtriangle.c:181
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:218
int lwcollection_is_empty(const LWCOLLECTION *col)
Definition: lwcollection.c:501
#define LW_FALSE
Definition: liblwgeom.h:77
#define TINTYPE
Definition: liblwgeom.h:99
int lwpoly_is_empty(const LWPOLY *poly)
Definition: lwpoly.c:445
int lwcircstring_is_empty(const LWCIRCSTRING *circ)
Definition: lwcircstring.c:276
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:90
int lwline_is_empty(const LWLINE *line)
Definition: lwline.c:525
#define MULTISURFACETYPE
Definition: liblwgeom.h:96
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:85
int lwpoint_is_empty(const LWPOINT *point)
Definition: lwpoint.c:291
uint8_t type
Definition: liblwgeom.h:396
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:92
#define MULTILINETYPE
Definition: liblwgeom.h:89
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
#define COLLECTIONTYPE
Definition: liblwgeom.h:91
Here is the call graph for this function: