momepy.street_alignment#

momepy.street_alignment(building_orientation, street_orientation, street_index)[source]#

Calulate the deviation of the building orientation from the street orientation.

Parameters:
building_orientationSeries

Series with the orientation of buildings. Can be measured using orientation().

street_orientationSeries

Series with the orientation of streets. Can be measured using orientation().

street_indexSeries

Series with the index of the street to which the building belongs. Can be retrieved using momepy.get_nearest_street().

Returns:
Series

Examples

>>> path = momepy.datasets.get_path("bubenec")
>>> buildings = geopandas.read_file(path, layer="buildings")
>>> streets = geopandas.read_file(path, layer="streets")

Get street index.

>>> buildings["street_index"] = momepy.get_nearest_street(buildings, streets)
>>> buildings.head()
   uID                                           geometry  street_index
0    1  POLYGON ((1603599.221 6464369.816, 1603602.984...           0.0
1    2  POLYGON ((1603042.88 6464261.498, 1603038.961 ...          33.0
2    3  POLYGON ((1603044.65 6464178.035, 1603049.192 ...          10.0
3    4  POLYGON ((1603036.557 6464141.467, 1603036.969...           8.0
4    5  POLYGON ((1603082.387 6464142.022, 1603081.574...           8.0

Compute orientations.

>>> blg_orient = momepy.orientation(buildings)
>>> str_orient = momepy.orientation(streets)

Compute street alignment.

>>> momepy.street_alignment(blg_orient, str_orient, buildings["street_index"])
0      0.290739
1      4.542071
2      0.105745
3      0.424903
4      0.823533
        ...
139    1.779876
140    0.109254
141    0.466453
142    1.223387
143    0.455081
Name: street_alignment, Length: 144, dtype: float64