momepy.square_compactness#
- momepy.square_compactness(geometry)[source]#
Calculates the square compactness of each object given its geometry.
\[\begin{equation*} \left(\frac{4 \sqrt{area}}{perimeter}\right) ^ 2 \end{equation*}\]Adapted from [Feliciotti, 2018].
- Parameters:
- geometryGeoDataFrame | GeoSeries
A GeoDataFrame or GeoSeries containing polygons to analyse.
- Returns:
- Series
Examples
>>> path = momepy.datasets.get_path("bubenec") >>> buildings = geopandas.read_file(path, layer="buildings") >>> momepy.square_compactness(buildings) 0 0.619387 1 0.182604 2 0.887750 3 0.719750 4 0.894034 ... 139 0.940666 140 0.824085 141 0.647576 142 0.914813 143 0.999961 Length: 144, dtype: float64