momepy.CentroidCorners#

momepy.CentroidCorners(gdf, verbose=True)[source]#

Calculates the mean distance centroid - corners and standard deviation. Returns np.nan for true MultiPolygons (containing multiple geometries). MultiPolygons with a singular geometry are treated as Polygons.

\[\overline{x}=\frac{1}{n}\left(\sum_{i=1}^{n} dist_{i}\right); \space \mathrm{SD}=\sqrt{\frac{\sum|x-\overline{x}|^{2}}{n}}\]

Adapted from [Schirmer and Axhausen, 2015] and [Cimburova, 2017].

Parameters:
gdfGeoDataFrame

A GeoDataFrame containing objects.

verbosebool (default True)

If True, shows progress bars in loops and indication of steps.

Attributes:
meanSeries

A Series containing mean distance values.

stdSeries

A Series containing standard deviation values.

gdfGeoDataFrame

The original GeoDataFrame.

Examples

>>> ccd = momepy.CentroidCorners(buildings_df)
100%|██████████| 144/144 [00:00<00:00, 846.58it/s]
>>> buildings_df['ccd_means'] = ccd.mean
>>> buildings_df['ccd_stdev'] = ccd.std
>>> buildings_df['ccd_means'][0]
15.961531913184833
>>> buildings_df['ccd_stdev'][0]
3.0810634305400177