geopandas.GeoSeries.geom_almost_equals#

GeoSeries.geom_almost_equals(other, decimal=6, align=None)[source]#

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 precision used when testing for approximate equality.

alignbool | None (default None)

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

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 1.1)
1     POINT (0 1.01)
2    POINT (0 1.001)
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