shapely.extract_unique_points

shapely.extract_unique_points#

extract_unique_points(geometry, **kwargs)#

Returns all distinct vertices of an input geometry as a multipoint.

Note that only 2 dimensions of the vertices are considered when testing for equality.

Parameters:
geometryGeometry or array_like
**kwargs

See NumPy ufunc docs for other keyword arguments.

Examples

>>> from shapely import LineString, MultiPoint, Point, Polygon
>>> extract_unique_points(Point(0, 0))
<MULTIPOINT ((0 0))>
>>> extract_unique_points(LineString([(0, 0), (1, 1), (1, 1)]))
<MULTIPOINT ((0 0), (1 1))>
>>> extract_unique_points(Polygon([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)]))
<MULTIPOINT ((0 0), (1 0), (1 1), (0 1))>
>>> extract_unique_points(MultiPoint([(0, 0), (1, 1), (0, 0)]))
<MULTIPOINT ((0 0), (1 1))>
>>> extract_unique_points(LineString())
<MULTIPOINT EMPTY>