momepy.orientation#

momepy.orientation(geometry)[source]#

Calculate the orientation of objects.

The ‘orientation’ is defined as the deviation of orientation of the bounding rectangle from cardinal directions. As such it is within a range 0 - 45. The orientation of LineStrings is represented by the orientation of the line connecting the first and the last point of the segment.

Adapted from [Schirmer and Axhausen, 2015].

Parameters:
geometryGeoDataFrame | GeoSeries

A GeoDataFrame or GeoSeries containing polygons to analyse.

Returns:
Series

Examples

>>> path = momepy.datasets.get_path("bubenec")
>>> buildings = geopandas.read_file(path, layer="buildings")
>>> momepy.orientation(buildings)
0      41.051468
1      20.829200
2      20.969610
3      20.811525
4      20.412895
         ...
139    21.107057
140    13.669062
141    13.671217
142    21.463914
143    13.754569
Name: orientation, Length: 144, dtype: float64