shapely.node#
- node(geometry, **kwargs)#
Returns the fully noded version of the linear input as MultiLineString.
Given a linear input geometry, this function returns a new MultiLineString in which no lines cross each other but only touch at and points. To obtain this, all intersections between segments are computed and added to the segments, and duplicate segments are removed.
Non-linear input (points) will result in an empty MultiLineString.
This function can for example be used to create a fully-noded linework suitable to passed as input to
polygonize
.- Parameters:
- geometryGeometry or array_like
- **kwargs
See NumPy ufunc docs for other keyword arguments.
Examples
>>> from shapely import LineString, Point >>> line = LineString([(0, 0), (1,1), (0, 1), (1, 0)]) >>> node(line) <MULTILINESTRING ((0 0, 0.5 0.5), (0.5 0.5, 1 1, 0 1, 0.5 0.5), (0.5 0.5, 1 0))> >>> node(Point(1, 1)) <MULTILINESTRING EMPTY>