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

Returns True if the geometries are structurally equivalent within a given tolerance.

This method uses exact coordinate equality, which requires coordinates to be equal (within specified tolerance) and in the same order for all components (vertices, rings, or parts) of a geometry. This is in contrast with the equals() function which uses spatial (topological) equality and does not require all components to be in the same order. Because of this, it is possible for equals() to be True while equals_exact() is False.

The order of the coordinates can be normalized (by setting the normalize keyword to True) so that this function will return True when geometries are structurally equivalent but differ only in the ordering of vertices. However, this function will still return False if the order of interior rings within a Polygon or the order of geometries within a multi geometry are different.

a, bGeometry or array_like
tolerancefloat or array_like (default: 0.)
normalizebool, optional (default: False)

If True, normalize the two geometries so that the coordinates are in the same order.

Added in version 2.1.0.


See NumPy ufunc docs for other keyword arguments.

See also


Check if a and b are spatially (topologically) equal.


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

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)
>>> equals(polygon1, polygon2)