momepy.shared_walls#

momepy.shared_walls(geometry, strict=True, tolerance=0.01)[source]#

Calculate the length of shared walls of adjacent elements (typically buildings).

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

Adapted from [Hamaina et al., 2012].

Parameters:
geometryGeoDataFrame | GeoSeries

A GeoDataFrame or GeoSeries containing polygons to analyse.

strictbool

Perform calculations based on strict contiguity. If set to False, consider overlapping or nearly overlapping polygons as touching.

tolerance: float

Tolerance for non-strict calculations, if strict is True, tolerance has no effect on the results.

Returns:
Series

Examples

>>> path = momepy.datasets.get_path("bubenec")
>>> buildings = geopandas.read_file(path, layer="buildings")
>>> momepy.shared_walls(buildings)
0       0.000000
1      33.805154
2      39.766297
3      40.604643
4      40.455735
        ...
139     9.886397
140     0.000000
141     0.000000
142    19.332735
143    10.876113
Name: shared_walls, Length: 144, dtype: float64