blocksnet.method.centrality

Classes

Centrality(*, city_model[, verbose])

Provides methods to analyze the distribution and diversity of points of interest in urban areas, measure connectivity, and compute centrality indices based on various geometric and network properties.

class blocksnet.method.centrality.Centrality(*, city_model: City, verbose: bool = True)[source]

Bases: BaseMethod

Provides methods to analyze the distribution and diversity of points of interest in urban areas, measure connectivity, and compute centrality indices based on various geometric and network properties.

plot(gdf, linewidth=0.1, figsize=(10, 10))[source]

Plots centrality data on a map.

diversity : gpd.GeoDataFrame

Calculates diversity for the city model.

connectivity : gpd.GeoDataFrame

Calculates connectivity for the city model.

calculate(connectivity_weight=1, density_weight=1, diversity_weight=1) gpd.GeoDataFrame[source]

Calculates centrality metrics for polygons based on point data and connectivity.

static plot(gdf: GeoDataFrame, linewidth: float = 0.1, figsize: tuple[int, int] = (10, 10))[source]

Plots centrality data for blocks on a map.

Parameters:
  • gdf (geopandas.GeoDataFrame) – GeoDataFrame containing block geometries and centrality data.

  • linewidth (float, optional) – Line width for plotting the geometries, by default 0.1.

  • figsize (tuple of int, optional) – Size of the figure to plot, by default (10, 10).

Return type:

None

property diversity: GeoDataFrame

Calculates diversity for the city model.

Returns:

GeoDataFrame containing blocks with calculated diversity of services.

Return type:

geopandas.GeoDataFrame

property connectivity: GeoDataFrame

Calculate connectivity for the city model.

Returns: - A GeoDataFrame representing connectivity metrics.

calculate(connectivity_weight: float = 1, density_weight: float = 1, diversity_weight: float = 1) GeoDataFrame[source]

Calculates centrality metrics for polygons based on point data and connectivity.

Parameters:
  • connectivity_weight (float, optional) – Weight for the connectivity metric, by default 1.

  • density_weight (float, optional) – Weight for the density metric, by default 1.

  • diversity_weight (float, optional) – Weight for the diversity metric, by default 1.

Returns:

GeoDataFrame containing blocks with calculated centrality metrics.

Return type:

geopandas.GeoDataFrame

model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.