assert_geom_almost_equal#
- assert_geom_almost_equal(geom_1: str | CloudPath | Path | GeoDataFrame, geom_2: str | CloudPath | Path | GeoDataFrame, decimal: int | str = 'auto', ignore_z: bool = True, ignore_order: bool = 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 (AnyVectorType) – Geometry 1
geom_2 (AnyVectorType) – Geometry 2
decimal (int) – Number of decimals. Set it to
autofor managing automatically the decimals in projected or geographiic CRS. 9 decimals for degrees, 3 for meters.ignore_z (bool) – Ignore Z coordinate
ignore_order (bool) – Ignore orderf of the features. True by default, meaning the geometries will be re-sorted and index resetted
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