shapely.get_num_interior_rings

shapely.get_num_interior_rings#

get_num_interior_rings(geometry, **kwargs)#

Returns number of internal rings in a polygon

Returns 0 for not-a-geometry values.

Parameters:
geometryGeometry or array_like

The number of interior rings in non-polygons equals zero.

**kwargs

See NumPy ufunc docs for other keyword arguments.

Examples

>>> from shapely import Point, Polygon
>>> polygon = Polygon([(0, 0), (0, 10), (10, 10), (10, 0), (0, 0)])
>>> get_num_interior_rings(polygon)
0
>>> polygon_with_hole = Polygon(
...     [(0, 0), (0, 10), (10, 10), (10, 0), (0, 0)],
...     holes=[[(2, 2), (2, 4), (4, 4), (4, 2), (2, 2)]]
... )
>>> get_num_interior_rings(polygon_with_hole)
1
>>> get_num_interior_rings(Point(0, 0))
0
>>> get_num_interior_rings(None)
0