shapely.get_num_geometries#

get_num_geometries(geometry, **kwargs)#

Returns number of geometries in a collection.

Returns 0 for not-a-geometry values.

Parameters
geometryGeometry or array_like

The number of geometries in points, linestrings, linearrings and polygons equals one.

**kwargs

For other keyword-only arguments, see the NumPy ufunc docs.

Examples

>>> from shapely import MultiPoint, Point
>>> get_num_geometries(MultiPoint([(0, 0), (1, 1), (2, 2), (3, 3)]))
4
>>> get_num_geometries(Point(1, 1))
1
>>> get_num_geometries(None)
0