momepy.SharedWallsRatio

class momepy.SharedWallsRatio(gdf, unique_id, perimeters=None)[source]

Calculate shared walls ratio of adjacent elements (typically buildings)

\[\textit{length of shared walls} \over perimeter\]

Note that data needs to be topologically correct. Overlapping polygons will lead to incorrect results.

Parameters:
gdf : GeoDataFrame

GeoDataFrame containing gdf to analyse

unique_id : str, list, np.array, pd.Series

the name of the dataframe column, np.array, or pd.Series with unique id

perimeters : str, list, np.array, pd.Series (default None)

the name of the dataframe column, np.array, or pd.Series where is stored perimeter value

References

Hamaina R, Leduc T and Moreau G (2012) Towards Urban Fabrics Characterization Based on Buildings Footprints. In: Lecture Notes in Geoinformation and Cartography, Berlin, Heidelberg: Springer Berlin Heidelberg, pp. 327–346. Available from: https://link.springer.com/chapter/10.1007/978-3-642-29063-3_18.

Examples

>>> buildings_df['swr'] = momepy.SharedWallsRatio(buildings_df, 'uID').series
100%|██████████| 144/144 [00:00<00:00, 648.72it/s]
>>> buildings_df['swr'][10]
0.3424804411228673
Attributes:
series : Series

Series containing resulting values

gdf : GeoDataFrame

original GeoDataFrame

id : Series

Series containing used unique ID

perimeters : GeoDataFrame

Series containing used perimeters values

sindex : rtree spatial index

spatial index of gdf

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

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

Methods

__init__(self, gdf, unique_id[, perimeters]) Initialize self.