momepy.CompactnessWeightedAxis#

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

Calculates the compactness-weighted axis of each object in a given GeoDataFrame. Initially designed for blocks.

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

A GeoDataFrame containing objects.

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

The name of the dataframe column, np.array, or pd.Series where area value are stored . If set to None, this 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 perimeter values are stored. If set to None, this 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 longest axis length values are stored. If set to None, this function will calculate longest axis lengths during the process without saving them separately.

Examples

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

A Series containing resulting values

gdfGeoDataFrame

The original GeoDataFrame.

areasSeries

A Series containing used area values.

longest_axisSeries

A Series containing used area values.

perimetersSeries

A Series containing used area values.

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

Methods

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