popframe.preprocessing.utils

Functions

drop_contained_geometries(gdf)

Drops geometries that are contained inside other geometries.

fill_holes(gdf)

Fills holes in geometries of a given GeoDataFrame

filter_bottlenecks(gdf, projected_crs[, ...])

Divides geometries in narrow places and removes small geometries.

get_projected_crs(poly)

Returns a local projected CRS for a given polygon.

verbose_print(text[, verbose])

popframe.preprocessing.utils.verbose_print(text, verbose=True)[source]
popframe.preprocessing.utils.get_projected_crs(poly)[source]

Returns a local projected CRS for a given polygon. If no matching local CRS found, returns EPSG:3857.

Attributes

poly: shapely.Polygon or shapely.MultiPolygon

A polygon of a place.

Returns

projected_crs: pyproj.CRS

Projected CRS.

popframe.preprocessing.utils.fill_holes(gdf)[source]

Fills holes in geometries of a given GeoDataFrame

Attributes

gdf: gpd.GeoDataFrame

GeoDataFrame with geometries to be filled.

Returns

gdf: gpd.GeoDataFrame

GeoDataFrame with filled geometries.

popframe.preprocessing.utils.drop_contained_geometries(gdf)[source]

Drops geometries that are contained inside other geometries.

Attributes

gdf: gpd.GeoDataFrame

GeoDataFrame with contained geometries.

Returns

gdf: gpd.GeoDataFrame

GeoDataFrame without contained geometries.

popframe.preprocessing.utils.filter_bottlenecks(gdf, projected_crs, min_width=40)[source]

Divides geometries in narrow places and removes small geometries.

Attributes

gdf: gpd.GeoDataFrame

GeoDataFrame with contained geometries.

projected_crs: int or pyproj.CRS

Metric projected CRS of a given area.

min_width: int or float

Minimum allowed width of geometries in resulting GeoDataFrame.

Returns

gdf: gpd.GeoDataFrame

GeoDataFrame with processed geometries.