shapely.intersection_all

shapely.intersection_all#

intersection_all(geometries, axis=None, **kwargs)#

Return the intersection of multiple geometries.

This function ignores None values when other Geometry elements are present. If all elements of the given axis are None, an empty GeometryCollection is returned.

Parameters:
geometriesarray_like

Geometries to calculate the intersection of.

axisint, optional

Axis along which the operation is performed. The default (None) performs the operation over all axes, returning a scalar value. Axis may be negative, in which case it counts from the last to the first axis.

**kwargs

See NumPy ufunc docs for other keyword arguments.

See also

intersection

Examples

>>> from shapely import LineString
>>> line1 = LineString([(0, 0), (2, 2)])
>>> line2 = LineString([(1, 1), (3, 3)])
>>> intersection_all([line1, line2])
<LINESTRING (1 1, 2 2)>
>>> intersection_all([[line1, line2, None]], axis=1).tolist()
[<LINESTRING (1 1, 2 2)>]
>>> intersection_all([line1, None])
<LINESTRING (0 0, 2 2)>