shapely.equals_exact

Contents

shapely.equals_exact#

equals_exact(a, b, tolerance=0.0, **kwargs)#

Returns True if A and B are structurally equal.

This method uses exact coordinate equality, which requires coordinates to be equal (within specified tolerance) and and in the same order for all components of a geometry. This is in contrast with the equals function which uses spatial (topological) equality.

Parameters:
a, bGeometry or array_like
tolerancefloat or array_like
**kwargs

See NumPy ufunc docs for other keyword arguments.

See also

equals

Check if A and B are spatially equal.

Examples

>>> from shapely import Point, Polygon
>>> point1 = Point(50, 50)
>>> point2 = Point(50.1, 50.1)
>>> equals_exact(point1, point2)
False
>>> equals_exact(point1, point2, tolerance=0.2)
True
>>> equals_exact(point1, None, tolerance=0.2)
False

Difference between structucal and spatial equality:

>>> polygon1 = Polygon([(0, 0), (1, 1), (0, 1), (0, 0)])
>>> polygon2 = Polygon([(0, 0), (0, 1), (1, 1), (0, 0)])
>>> equals_exact(polygon1, polygon2)
False
>>> equals(polygon1, polygon2)
True