osm_flex.simplify

This file is part of OSM-flex. Copyright (C) 2023 OSM-flex contributors listed in AUTHORS. OSM-flex is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. OSM-flex is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. —– simplification functions

Module Contents

Functions

remove_small_polygons(gdf, min_area)

Remove (multi-)polygons of area smaller than min_area

remove_contained_points(gdf_p_mp)

from a GeoDataFrame containing points and (multi-)polygons, remove those

remove_contained_polys(gdf)

from a GeoDataFrame containing (multi-)polygons (and potentially other

remove_exact_duplicates(gdf)

from a GeoDataFrame containing any sort of geometries, remove those entries

osm_flex.simplify.remove_small_polygons(gdf, min_area)[source]

Remove (multi-)polygons of area smaller than min_area Points and lines are untouched.

Note: a buffer of 1e-10 is added to invalid geometries

Parameters

gdfGeoDataFrame

geodataframe with polygons

min_areafloat

minimal value of area

Return

GeoDataFrame:

entry geodataframe without (multi-)polygons smaller than min_area

osm_flex.simplify.remove_contained_points(gdf_p_mp)[source]

from a GeoDataFrame containing points and (multi-)polygons, remove those points that are contained in a multipolygons entry. Resets the index of the dataframe.

Parameters

gdf_p_mpgpd.GeoDataFrame

GeoDataFrame containing entries with point and (multi-)polygon geometry

osm_flex.simplify.remove_contained_polys(gdf)[source]

from a GeoDataFrame containing (multi-)polygons (and potentially other geometries), remove those polygon entries that are already fully contained in another polygon entries. Removes smaller polygons within polygons and full duplicates, but leaves contained points untouched (see remove_contained_points() for this).

Resets the index of the dataframe.

Parameters

gdfgpd.GeoDataFrame

GeoDataFrame containing entries with (multi-)polygon geometry

osm_flex.simplify.remove_exact_duplicates(gdf)[source]

from a GeoDataFrame containing any sort of geometries, remove those entries which already have an exact duplicate geometry entry.

Resets the index of the dataframe.

Parameters

gdfgpd.GeoDataFrame

GeoDataFrame containing any types of geometry