assert_geom_almost_equal

assert_geom_almost_equal#

assert_geom_almost_equal(geom_1: str | CloudPath | Path | GeoDataFrame, geom_2: str | CloudPath | Path | GeoDataFrame, decimal=9, ignore_z=True) None[source]#

Assert that two geometries are equal (do not check equality between geodataframe as they may differ on other fields).

Useful for pytests.

Parameters:
  • geom_1 (Union[AnyPathStrType, "gpd.GeoDataFrame"]) – Geometry 1

  • geom_2 (Union[AnyPathStrType, "gpd.GeoDataFrame"]) – Geometry 2

  • decimal (int) – Number of decimal

  • ignore_z (bool) – Ignore Z coordinate

Warning

Only checks:
  • valid geometries

  • length of GeoDataFrame

  • CRS

Example

>>> path = r"CI/DATA/vectors/aoi.geojson"
>>> assert_geom_almost_equal(path, path)
>>> # Raises AssertionError if sth goes wrong