momepy.CompactnessWeightedAxis

class momepy.CompactnessWeightedAxis(gdf, areas=None, perimeters=None, longest_axis=None)[source]

Calculates compactness-weighted axis of each object in given GeoDataFrame.

Initially designed for blocks.

\[d_{i} \times\left(\frac{4}{\pi}-\frac{16 (area_{i})} {perimeter_{i}^{2}}\right)\]
Parameters
gdfGeoDataFrame

GeoDataFrame containing objects

areasstr, list, np.array, pd.Series (default None)

the name of the dataframe column, np.array, or pd.Series where is stored area value. If set to None, function will calculate areas during the process without saving them separately.

perimetersstr, list, np.array, pd.Series (default None)

the name of the dataframe column, np.array, or pd.Series where is stored perimeter value. If set to None, function will calculate perimeters during the process without saving them separately.

longest_axisstr, list, np.array, pd.Series (default None)

the name of the dataframe column, np.array, or pd.Series where is stored longest axis length value. If set to None, function will calculate it during the process without saving them separately.

Examples

>>> blocks_df['cwa'] = mm.CompactnessWeightedAxis(blocks_df).series
Attributes
seriesSeries

Series containing resulting values

gdfGeoDataFrame

original GeoDataFrame

areasSeries

Series containing used area values

longest_axisSeries

Series containing used area values

perimetersSeries

Series containing used area values

__init__(gdf, areas=None, perimeters=None, longest_axis=None)[source]

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

Methods

__init__(gdf[, areas, perimeters, longest_axis])

Initialize self.