shapely.get_interior_ring

shapely.get_interior_ring#

get_interior_ring(geometry, index, **kwargs)#

Returns the nth interior ring of a polygon.

Parameters:
geometryGeometry or array_like
indexint or array_like

Negative values count from the end of the interior rings backwards.

**kwargs

See NumPy ufunc docs for other keyword arguments.

Examples

>>> from shapely import Point, Polygon
>>> 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_interior_ring(polygon_with_hole, 0)
<LINEARRING (2 2, 2 4, 4 4, 4 2, 2 2)>
>>> get_interior_ring(polygon_with_hole, 1) is None
True
>>> polygon = Polygon([(0, 0), (0, 10), (10, 10), (10, 0), (0, 0)])
>>> get_interior_ring(polygon, 0) is None
True
>>> get_interior_ring(Point(0, 0), 0) is None
True