shapely.reverse

Contents

shapely.reverse#

reverse(geometry, **kwargs)#

Returns a copy of a Geometry with the order of coordinates reversed.

If a Geometry is a polygon with interior rings, the interior rings are also reversed.

Points are unchanged. None is returned where Geometry is None.

Parameters:
geometryGeometry or array_like
**kwargs

See NumPy ufunc docs for other keyword arguments.

See also

is_ccw

Checks if a Geometry is clockwise.

Examples

>>> from shapely import LineString, Polygon
>>> reverse(LineString([(0, 0), (1, 2)]))
<LINESTRING (1 2, 0 0)>
>>> reverse(Polygon([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)]))
<POLYGON ((0 0, 0 1, 1 1, 1 0, 0 0))>
>>> reverse(None) is None
True