shapely.length#
- length(geometry, **kwargs)#
Compute the length of a (multi)linestring or polygon perimeter.
- Parameters:
- geometryGeometry or array_like
Geometry or geometries for which to compute the length.
- **kwargs
See NumPy ufunc docs for other keyword arguments.
Examples
>>> import shapely >>> from shapely import LineString, MultiLineString, Polygon >>> shapely.length(LineString([(0, 0), (0, 2), (3, 2)])) 5.0 >>> shapely.length(MultiLineString([ ... LineString([(0, 0), (1, 0)]), ... LineString([(1, 0), (2, 0)]) ... ])) 2.0 >>> shapely.length(Polygon([(0, 0), (0, 10), (10, 10), (10, 0), (0, 0)])) 40.0 >>> shapely.length(LineString()) 0.0 >>> shapely.length(None) nan