shapely.shared_paths#
- shared_paths(a, b, **kwargs)#
Return the shared paths between a and b.
Both geometries should be linestrings or arrays of linestrings. A geometrycollection or array of geometrycollections is returned with two elements in each geometrycollection. The first element is a multilinestring containing shared paths with the same direction for both inputs. The second element is a multilinestring containing shared paths with the opposite direction for the two inputs.
- Parameters:
- a, bGeometry or array_like
Linestring or linestrings to compare.
- **kwargs
See NumPy ufunc docs for other keyword arguments.
Examples
>>> from shapely import LineString >>> line1 = LineString([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)]) >>> line2 = LineString([(1, 0), (2, 0), (2, 1), (1, 1), (1, 0)]) >>> shared_paths(line1, line2).wkt 'GEOMETRYCOLLECTION (MULTILINESTRING EMPTY, MULTILINESTRING ((1 0, 1 1)))' >>> line3 = LineString([(1, 1), (0, 1)]) >>> shared_paths(line1, line3).wkt 'GEOMETRYCOLLECTION (MULTILINESTRING ((1 1, 0 1)), MULTILINESTRING EMPTY)'