geopandas.GeoSeries.geom_almost_equals

GeoSeries.geom_almost_equals(other, decimal=6, align=True)

Returns a Series of dtype('bool') with value True if each aligned geometry is approximately equal to other.

Approximate equality is tested at all points to the specified decimal place precision.

The operation works on a 1-to-1 row-wise manner:

../../../_images/binary_op-01.svg
Parameters
otherGeoSeries or geometric object

The GeoSeries (elementwise) or geometric object to compare to.

decimalint

Decimal place presion used when testing for approximate equality.

alignbool (default True)

If True, automatically aligns GeoSeries based on their indices. If False, the order of elements is preserved.

Returns
Series (bool)

Notes

This method works in a row-wise manner. It does not check if an element of one GeoSeries is equal to any element of the other one.

Examples

>>> from shapely.geometry import Point
>>> s = geopandas.GeoSeries(
...     [
...         Point(0, 1.1),
...         Point(0, 1.01),
...         Point(0, 1.001),
...     ],
... )
>>> s
0    POINT (0.00000 1.10000)
1    POINT (0.00000 1.01000)
2    POINT (0.00000 1.00100)
dtype: geometry
>>> s.geom_almost_equals(Point(0, 1), decimal=2)
0    False
1    False
2     True
dtype: bool
>>> s.geom_almost_equals(Point(0, 1), decimal=1)
0    False
1     True
2     True
dtype: bool