momepy.CompactnessWeightedAxis#
- 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
, orpd.Series
where area value are stored . If set toNone
, 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
, orpd.Series
where perimeter values are stored. If set toNone
, 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
, orpd.Series
where longest axis length values are stored. If set toNone
, this function will calculate longest axis lengths during the process without saving them separately.
- 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.
Examples
>>> blocks_df['cwa'] = mm.CompactnessWeightedAxis(blocks_df).series