momepy.BuildingAdjacency

class momepy.BuildingAdjacency(gdf, spatial_weights_higher, unique_id, spatial_weights=None)[source]

Calculate the level of building adjacency

Building adjacency reflects how much buildings tend to join together into larger structures. It is calculated as a ratio of joined built-up structures and buildings within the extent defined in spatial_weights_higher.

\[\]
Parameters
gdfGeoDataFrame

GeoDataFrame containing objects to analyse

spatial_weights_higherlibpysal.weights

spatial weights matrix

unique_idstr

name of the column with unique id used as spatial_weights index

spatial_weightslibpysal.weights, optional

spatial weights matrix - If None, Queen contiguity matrix will be calculated based on gdf. It is to denote adjacent buildings (note: based on unique ID).

References

Vanderhaegen S and Canters F (2017) Mapping urban form and function at city block level using spatial metrics. Landscape and Urban Planning 167: 399–409.

Examples

>>> buildings_df['adjacency'] = momepy.BuildingAdjacency(buildings_df, swh, unique_id='uID').series
Calculating spatial weights...
Spatial weights ready...
100%|██████████| 144/144 [00:00<00:00, 9301.73it/s]
Calculating adjacency...
100%|██████████| 144/144 [00:00<00:00, 335.55it/s]
>>> buildings_df['adjacency'][10]
0.23809523809523808
Attributes
seriesSeries

Series containing resulting values

gdfGeoDataFrame

original GeoDataFrame

sw_higherlibpysal.weights

spatial weights matrix

idSeries

Series containing used unique ID

swlibpysal.weights

spatial weights matrix

__init__(self, gdf, spatial_weights_higher, unique_id, spatial_weights=None)[source]

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__(self, gdf, spatial_weights_higher, …)

Initialize self.