geopandas.GeoSeries.invalid_coverage_edges#
- GeoSeries.invalid_coverage_edges(*, gap_width=0.0)[source]#
Returns a
GeoSeries
containing edges causing invalid polygonal coverageThis method returns (Multi)LineStrings showing the location of edges violating polygonal coverage (if any) in each polygon in the input
GeoSeries
.A
GeoSeries
of valid polygons is considered a coverage if the polygons are:Non-overlapping - polygons do not overlap (their interiors do not intersect)
Edge-Matched - vertices along shared edges are identical
A valid coverage may contain holes (regions of no coverage). However, sometimes it might be desirable to detect narrow gaps as invalidities in the coverage. The
gap_width
parameter allows to specify the maximum width of gaps to detect. When gaps are detected, theis_valid_coverage()
method will returnFalse
and this method can be used to find the edges of those gaps.Geometries that are not Polygon or MultiPolygon are ignored.
Requires Shapely >= 2.1.
Added in version 1.1.0.
- Parameters:
- gap_widthfloat, optional
The maximum width of gaps to detect, by default 0.0
- Returns:
- GeoSeries
Examples
Violation of edge-matching:
>>> from shapely import Polygon >>> s = geopandas.GeoSeries( ... [ ... Polygon([(0, 0), (1, 1), (1, 0), (0, 0)]), ... Polygon([(0, 0), (0.5, 0.5), (1, 1), (0, 1), (0, 0)]) ... ] ... ) >>> s 0 POLYGON ((0 0, 1 1, 1 0, 0 0)) 1 POLYGON ((0 0, 0.5 0.5, 1 1, 0 1, 0 0)) dtype: geometry
>>> s.invalid_coverage_edges() 0 LINESTRING (0 0, 1 1) 1 LINESTRING (0 0, 0.5 0.5, 1 1) dtype: geometry