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 (multi-)polygons of area smaller than min_area |
|
from a GeoDataFrame containing points and (multi-)polygons, remove those |
from a GeoDataFrame containing (multi-)polygons (and potentially other |
|
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