momepy.MeanInterbuildingDistance#

momepy.MeanInterbuildingDistance(gdf, spatial_weights, unique_id, order=3, verbose=True)[source]#

Calculate the mean interbuilding distance. Interbuilding distances are calculated between buildings on adjacent cells based on spatial_weights, while the extent is defined as order of contiguity.

Parameters:
gdfGeoDataFrame

A GeoDataFrame containing objects to analyse.

unique_idstr

The name of the unique ID column used as the spatial_weights index.

spatial_weightslibpysal.weights

A spatial weights matrix.

orderint

The order of contiguity defining the extent.

verbosebool (default True)

If True, shows progress bars in loops and indication of steps.

Attributes:
seriesSeries

A Series containing resulting values.

gdfGeoDataFrame

The original GeoDataFrame.

swlibpysal.weights

The spatial weights matrix.

idSeries

A Series containing used unique ID.

sw_higherlibpysal.weights

The spatial weights matrix of higher order.

orderint

Order of contiguity.

Notes

Fix UserWarning.

Examples

>>> buildings_df['mean_interbuilding_distance'] = momepy.MeanInterbuildingDistance(
...     buildings_df,
...     sw,
...     'uID'
... ).series
Computing mean interbuilding distances...
100%|██████████| 144/144 [00:00<00:00, 317.42it/s]
>>> buildings_df['mean_interbuilding_distance'][0]
29.305457092042744