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

Notes

Deprecated since version 2.1.0: A deprecation warning is shown if axis is specified as a positional argument. This will need to be specified as a keyword argument in a future release.

Examples

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