blocksnet.utils.helpers

Some helping functions used to perform certain spatial operations and can be used in different modules.

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_polygon_aspect_ratio(polygon)

blocksnet.utils.helpers.fill_holes(gdf)[source]

Fills holes in geometries of a given GeoDataFrame

Variables:

gdf (gpd.GeoDataFrame) – GeoDataFrame with geometries to be filled.

Returns:

gdf – GeoDataFrame with filled geometries.

Return type:

gpd.GeoDataFrame

blocksnet.utils.helpers.drop_contained_geometries(gdf)[source]

Drops geometries that are contained inside other geometries.

Variables:

gdf (gpd.GeoDataFrame) – GeoDataFrame with contained geometries.

Returns:

gdf – GeoDataFrame without contained geometries.

Return type:

gpd.GeoDataFrame

blocksnet.utils.helpers.filter_bottlenecks(gdf, projected_crs, min_width=40)[source]

Divides geometries in narrow places and removes small geometries.

Variables:
  • 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 – GeoDataFrame with processed geometries.

Return type:

gpd.GeoDataFrame

blocksnet.utils.helpers.get_polygon_aspect_ratio(polygon: Polygon)[source]