momepy.Convexity#
- momepy.Convexity(gdf, areas=None)[source]#
Calculates the Convexity index of each object in a given GeoDataFrame.
\[area \over \textit{convex hull area}\]Adapted from [Dibble et al., 2017].
- 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 values stored. If set toNone
, this function will calculate areas 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.
Examples
>>> buildings_df['convexity'] = momepy.Convexity(buildings_df).series >>> buildings_df['convexity'][0] 0.8151964258521672