momepy.street_profile#
- momepy.street_profile(streets, buildings, distance=10, tick_length=50, height=None)[source]#
Calculates the street profile characters.
This functions returns a DataFrame with widths, standard deviation of width, openness, heights, standard deviation of height and ratio height/width. The algorithm generates perpendicular lines to the
streets
dataframe features everydistance
and measures values on intersections with features ofbuildings
. If no feature is reached withintick_length
its value is set as width (being a theoretical maximum).Derived from [Araldi and Fusco, 2019].
- Parameters:
- streetsGeoDataFrame
A GeoDataFrame containing streets to analyse.
- buildingsGeoDataFrame
A GeoDataFrame containing buildings along the streets. Only Polygon geometries are currently supported.
- distanceint (default 10)
The distance between perpendicular ticks.
- tick_lengthint (default 50)
The length of ticks.
- height: pd.Series (default None)
The
pd.Series
where building height are stored. If set toNone
, height and ratio height/width will not be calculated.
- Returns:
- DataFrame
Examples
>>> path = momepy.datasets.get_path("bubenec") >>> buildings = geopandas.read_file(path, layer="buildings") >>> streets = geopandas.read_file(path, layer="streets") >>> streets.head() geometry 0 LINESTRING (1603585.64 6464428.774, 1603413.20... 1 LINESTRING (1603268.502 6464060.781, 1603296.8... 2 LINESTRING (1603607.303 6464181.853, 1603592.8... 3 LINESTRING (1603678.97 6464477.215, 1603675.68... 4 LINESTRING (1603537.194 6464558.112, 1603557.6...
>>> result = momepy.street_profile(streets, buildings) >>> result.head() width openness width_deviation 0 47.905964 0.946429 0.020420 1 42.418068 0.615385 2.644521 2 32.131831 0.608696 2.864438 3 50.000000 1.000000 NaN 4 50.000000 1.000000 NaN
If you know height of each building, you can pass that along to get back more information:
>>> import numpy as np >>> import pandas as pd >>> rng = np.random.default_rng(seed=42) >>> height = pd.Series(rng.integers(low=9, high=30, size=len(buildings))) >>> result = momepy.street_profile(streets, buildings, height=height) >>> result.head() width openness width_deviation height height_deviation hw_ratio 0 47.905964 0.946429 0.020420 12.666667 4.618802 0.264407 1 42.418068 0.615385 2.644521 21.500000 6.467869 0.506859 2 32.131831 0.608696 2.864438 17.555556 4.901647 0.546360 3 50.000000 1.000000 NaN NaN NaN NaN 4 50.000000 1.000000 NaN NaN NaN NaN