momepy.Squareness#

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

Calculates the squareness of each object in a given GeoDataFrame. Uses only external shape (shapely.geometry.exterior), courtyards are not included. Returns np.nan for true MultiPolygons (containing multiple geometries). MultiPolygons with a singular geometry are treated as Polygons.

\[\mu=\frac{\sum_{i=1}^{N} d_{i}}{N}\]

where \(d\) is the deviation of angle of corner \(i\) from 90 degrees.

Adapted from [Dibble et al., 2017].

Parameters:
gdfGeoDataFrame

A GeoDataFrame containing objects.

verbosebool (default True)

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

Examples

>>> buildings_df['squareness'] = momepy.Squareness(buildings_df).series
100%|██████████| 144/144 [00:01<00:00, 129.49it/s]
>>> buildings_df.squareness[0]
3.7075816043359864
Attributes:
seriesSeries

A Series containing resulting values.

gdfGeoDataFrame

The original GeoDataFrame.

__init__(gdf, verbose=True)[source]#

Methods

__init__(gdf[, verbose])