shapely.reverse#

reverse(geometry, **kwargs)#

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

Note

‘reverse’ requires at least GEOS 3.7.0.

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

For other keyword-only arguments, see the NumPy ufunc docs.

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