dtoolkit.geoaccessor.geoseries.has_hole#
- dtoolkit.geoaccessor.geoseries.has_hole(s: GeoSeries, /) Series[source]#
Check if each Polygon geometries have holes.
Except for Polygon and MultiPolygon, other geometries will return
False.- Returns:
- Series(bool)
See also
Examples
>>> import dtoolkit.geoaccessor >>> import geopandas as gpd >>> from shapely import LineString, Point, Polygon >>> df = gpd.GeoDataFrame( ... geometry=[ ... Polygon( ... [(0, 0), (0, 5), (5, 5), (5, 0)], ... [[(1, 1), (2, 1), (1, 2)], [(1, 4), (2, 4), (2, 3)]], ... ), ... Polygon([(1, 0), (2, 1), (0, 0)]), ... LineString([(0, 0), (0, 5), (5, 5), (5, 0)]), ... Point(0, 0), ... ] ... ) >>> df geometry 0 POLYGON ((0 0, 0 5, 5 5, 5 0, 0 0), (1 1, 2 1,... 1 POLYGON ((1 0, 2 1, 0 0, 1 0)) 2 LINESTRING (0 0, 0 5, 5 5, 5 0) 3 POINT (0 0)
>>> df.has_hole() 0 True 1 False 2 False 3 False dtype: bool