momepy.compactness_weighted_axis¶
-
momepy.compactness_weighted_axis(geometry, longest_axis_length=
None)[source]¶ Calculates the compactness-weighted axis of each object in a given GeoDataFrame.
\[d_{i} \times\left(\frac{4}{\pi}-\frac{16 (area_{i})} {perimeter_{i}^{2}}\right)\]Examples
>>> path = momepy.datasets.get_path("bubenec") >>> buildings = geopandas.read_file(path, layer="buildings") >>> momepy.compactness_weighted_axis(buildings) 0 26.327730 1 208.588747 2 14.358370 3 26.026429 4 14.095118 ... 139 3.853623 140 12.462700 141 32.888900 142 3.975422 143 4.228395 Length: 144, dtype: float64If you know the longest axis length, you can pass it to skip the computation step.
>>> lal = momepy.longest_axis_length(buildings) >>> momepy.compactness_weighted_axis(buildings, longest_axis_length=lal) 0 26.327730 1 208.588747 2 14.358370 3 26.026429 4 14.095118 ... 139 3.853623 140 12.462700 141 32.888900 142 3.975422 143 4.228395 Length: 144, dtype: float64