momepy.perimeter_wall#

momepy.perimeter_wall(geometry, graph=None, buffer=0.01)[source]#

Calculate the perimeter wall length of the joined structure.

Parameters:
geometryGeoDataFrame | GeoSeries

A GeoDataFrame or GeoSeries containing polygons to analyse.

graphGraph | None, optional

Graph encoding Queen contiguity of geometry. If None Queen contiguity is built on the fly.

buffer: float

Buffer value for the geometry. It can be used to account for topological problems.

Returns:
Series

Examples

>>> path = momepy.datasets.get_path("bubenec")
>>> buildings = geopandas.read_file(path, layer="buildings")
>>> momepy.perimeter_wall(buildings)
0      137.186310
1      663.342296
2      663.342296
3      663.342296
4      663.342296
        ...
139     42.839590
140     78.562927
141    147.342182
142    118.354123
143    342.909172
Name: perimeter_wall, Length: 144, dtype: float64

By default, momepy calculates a Queen contiguity graph to determine connected components. Alternatively, you can pass that yourself. This can be useful when the graph is already computed or when you need to use a different method due to topological issues.

>>> from libpysal import graph
>>> strict_contig = graph.Graph.build_contiguity(
...     buildings, rook=False, strict=True,
... )
>>> momepy.perimeter_wall(buildings, graph=strict_contig)
0      137.186310
1      663.342296
2      663.342296
3      663.342296
4      663.342296
        ...
139     42.839590
140     78.562927
141    147.342182
142    118.354123
143    342.909172
Name: perimeter_wall, Length: 144, dtype: float64