momepy.squareness#

momepy.squareness(geometry, eps=10, include_interiors=False)[source]#

Calculates the squareness of each object given its geometry.

Squareness is a mean deviation of angles at corners from 90 degrees.

As a corner is considered a point where the angle between two consecutive segments deviates from 180 degrees by more than eps.

Parameters:
geometryGeoDataFrame | GeoSeries

A GeoDataFrame or GeoSeries containing polygons to analyse.

epsfloat, optional

Deviation from 180 degrees to consider a corner, by default 10

include_interiorsbool, optional

If True, polygon interiors are included in the calculation. If False, only exterior is considered, by default False

Returns:
Series

Examples

>>> path = momepy.datasets.get_path("bubenec")
>>> buildings = geopandas.read_file(path, layer="buildings")
>>> momepy.squareness(buildings)
0      3.707582
1      2.990318
2      0.437987
3      4.573564
4      0.382146
        ...
139    0.214733
140    0.307916
141    0.343259
142    0.899731
143    0.028140
Length: 144, dtype: float64