momepy.MeanInterbuildingDistance

class momepy.MeanInterbuildingDistance(gdf, spatial_weights, unique_id, spatial_weights_higher=None, order=3)[source]

Calculate the mean interbuilding distance

Interbuilding distances are calculated between buildings on adjacent cells based on spatial_weights, while the extent is defined in spatial_weights_higher.

\[\]
Parameters
gdfGeoDataFrame

GeoDataFrame containing objects to analyse

unique_idstr

name of the column with unique id used as spatial_weights index

spatial_weightslibpysal.weights

spatial weights matrix

spatial_weights_higherlibpysal.weights, optional

spatial weights matrix - If None, Queen contiguity of higher order will be calculated based on spatial_weights

orderint

Order of Queen contiguity

Notes

Fix UserWarning.

Examples

>>> buildings_df['mean_interbuilding_distance'] = momepy.MeanInterbuildingDistance(buildings_df, sw, 'uID').series
Generating weights matrix (Queen) of 3 topological steps...
Generating adjacency matrix based on weights matrix...
Computing interbuilding distances...
100%|██████████| 746/746 [00:03<00:00, 200.14it/s]
Computing mean interbuilding distances...
100%|██████████| 144/144 [00:00<00:00, 317.42it/s]
>>> buildings_df['mean_interbuilding_distance'][0]
29.305457092042744
Attributes
seriesSeries

Series containing resulting values

gdfGeoDataFrame

original GeoDataFrame

swlibpysal.weights

spatial weights matrix

idSeries

Series containing used unique ID

sw_higherlibpysal.weights

Spatial weights matrix of higher order

orderint

Order of Queen contiguity (only if spatial_weights_higher was not set)

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

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

Methods

__init__(self, gdf, spatial_weights, unique_id)

Initialize self.