PostGIS  2.5.7dev-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 1393 of file lwgeom.c.

1394 {
1395  int result = LW_FALSE;
1396  LWDEBUGF(4, "lwgeom_is_empty: got type %s",
1397  lwtype_name(geom->type));
1398 
1399  switch (geom->type)
1400  {
1401  case POINTTYPE:
1402  return lwpoint_is_empty((LWPOINT*)geom);
1403  break;
1404  case LINETYPE:
1405  return lwline_is_empty((LWLINE*)geom);
1406  break;
1407  case CIRCSTRINGTYPE:
1408  return lwcircstring_is_empty((LWCIRCSTRING*)geom);
1409  break;
1410  case POLYGONTYPE:
1411  return lwpoly_is_empty((LWPOLY*)geom);
1412  break;
1413  case TRIANGLETYPE:
1414  return lwtriangle_is_empty((LWTRIANGLE*)geom);
1415  break;
1416  case MULTIPOINTTYPE:
1417  case MULTILINETYPE:
1418  case MULTIPOLYGONTYPE:
1419  case COMPOUNDTYPE:
1420  case CURVEPOLYTYPE:
1421  case MULTICURVETYPE:
1422  case MULTISURFACETYPE:
1423  case POLYHEDRALSURFACETYPE:
1424  case TINTYPE:
1425  case COLLECTIONTYPE:
1426  return lwcollection_is_empty((LWCOLLECTION *)geom);
1427  break;
1428  default:
1429  lwerror("lwgeom_is_empty: unsupported input geometry type: %s",
1430  lwtype_name(geom->type));
1431  break;
1432  }
1433  return result;
1434 }
#define LW_FALSE
Definition: liblwgeom.h:77
#define COLLECTIONTYPE
Definition: liblwgeom.h:91
#define COMPOUNDTYPE
Definition: liblwgeom.h:93
#define CURVEPOLYTYPE
Definition: liblwgeom.h:94
#define MULTILINETYPE
Definition: liblwgeom.h:89
#define MULTISURFACETYPE
Definition: liblwgeom.h:96
#define LINETYPE
Definition: liblwgeom.h:86
#define MULTIPOINTTYPE
Definition: liblwgeom.h:88
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:85
#define TINTYPE
Definition: liblwgeom.h:99
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:90
#define POLYGONTYPE
Definition: liblwgeom.h:87
#define POLYHEDRALSURFACETYPE
Definition: liblwgeom.h:97
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:92
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:218
#define MULTICURVETYPE
Definition: liblwgeom.h:95
#define TRIANGLETYPE
Definition: liblwgeom.h:98
int lwline_is_empty(const LWLINE *line)
Definition: lwline.c:511
int lwpoint_is_empty(const LWPOINT *point)
Definition: lwpoint.c:291
int lwtriangle_is_empty(const LWTRIANGLE *triangle)
Definition: lwtriangle.c:174
int lwpoly_is_empty(const LWPOLY *poly)
Definition: lwpoly.c:418
int lwcircstring_is_empty(const LWCIRCSTRING *circ)
Definition: lwcircstring.c:269
int lwcollection_is_empty(const LWCOLLECTION *col)
Definition: lwcollection.c:508
#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
uint8_t type
Definition: liblwgeom.h:399

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 LWPOINT::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(), lwcollection_offsetcurve(), 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_grid_in_place(), 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_pointonsurface(), lwgeom_remove_repeated_points_in_place(), LWGEOM_segmentize2d(), lwgeom_segmentize_sphere(), LWGEOM_shortestline2d(), LWGEOM_shortestline3d(), lwgeom_simplify(), lwgeom_simplify_in_place(), lwgeom_subdivide(), lwgeom_subdivide_recursive(), 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_4d(), 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_clip_and_validate_geos(), mvt_geom(), mvt_iterate_clip_by_box_geos(), mvt_safe_clip_polygon_by_box(), mvt_unsafe_clip_by_box(), RASTER_asRaster(), RASTER_clip(), RASTER_nearestValue(), RASTER_setPixelValuesGeomval(), ShpLoaderGenerateShapeRow(), ST_CleanGeometry(), ST_OffsetCurve(), ST_Scale(), 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().

Here is the call graph for this function: