momepy.Streetscape#
- class momepy.Streetscape(streets, buildings, sightline_length=50, tangent_length=300, sightline_spacing=3, intersection_offset=0.5, angle_tolerance=5, height_col=None, category_col=None)[source]#
Streetscape analysis based on sightlines
The class is designed for morphological streetscape analysis, focusing on generating and analyzing streetscape measures based on sight points and sightlines. It places sight points at regular intervals along streets (
sightline_spacing
) and generates four rays from each point: two perpendicular and two tangent to the street. These rays intersect with building features, allowing the function to capture various point-based and street-based metrics.The function returns the following measures:
Point-level measures (for cross-sectional streetscape analysis):
os
: Open Space [m]sb
: Setback distance from the street edge [m],h
: Building Height [m] (if height data is providedheight_col
),hw
: Height-to-Width Ratio [-] (if height data is providedheight_col
),tan
: Visual depth along the street[m],tan_ratio
: Tangent-Width Ratio[-],csosva
: Cross-sectional Sky View Factor[°],cr
: Building Coverage Ratio [%]
Street-level measures (summarizing the entire street element):
par_tot
: Total Parallel Façades [-],par_rel
: RelativecParallel Façades [-],par_tot_15
: Total Parallel Façades within 15 meters[%],par_rel_15
: Relative Parallel Façades within 15 meters[%],built_freq
: Building Frequency,building_prevalence_Ti
: Prevalence of specific building types [%] (if
building classification is provided
category_col
).The method also provides the distribution of measures along the street, providing:
_*_std
: Standard Deviation,_*_mad
: Mean Absolute Deviation,_*_med
: Median,_*_mad_med
: Median Absolute Deviation
for the following indicators:
os
,sb
,h
,hw
,cr
,tan
.If no building or feature is found within the specified tick length, the function a ssigns a theoretical maximum value for
os
andsb
or0/NaN
depending on the variable.The function also provides the distribution of measures separately for the two sides of the street (right and left, assigned arbitrarily). Indicators for the left side are preceded by
left_*
and for the right side byright_*
At the same time, you can retrieve the index of buildings that intersected each sightline via*_seq_sb_index
.Additional street-level measures are:
street_length
(Street Length),windingness
(Windingness or Curvature of Streets, equal to 1 -linearity()
),nodes_degree_1
(Degree 1 Nodes, representing dead ends),nodes_degree_4
(Degree 4 Nodes, representing intersections with 4 connections), andnodes_degree_3_5_plus
(Degree 3-5 or More Nodes, representing intersections with 3, 5, or more connections).This is a direct implementation of the algorithm proposed in [Araldi and Fusco, 2024].
- Parameters:
- streetsgpd.GeoDataFrame
GeoDataFrame containing LineString geometry representing streets
- buildingsgpd.GeoDataFrame
GeoDataFrame containing Polygon geometry representing buildings
- sightline_lengthfloat, optional
length of the sightline generated at each sightline point perpendiculary to the street geometry, by default 50
- tangent_lengthfloat, optional
length of the sightline generated at each sightline point tangentially to the street geometry, by default 300
- sightline_spacingfloat, optional
approximate distance between sightline points generated along streets, by default 3
- intersection_offsetfloat, optional
Offset to use at the beginning and the end of each LineString. The first sightline point is generated at this distance from the start and the last one is generated at this distance from the end of each geometry, by default 0.5
- angle_tolerancefloat, optional
Maximum angle between sightlines that does not require infill lines to be generated, by default 5
- height_colstr, optional
name of a column of the buildings DataFrame containing the information about the building height in meters.
- category_colstr, optional
name of a column of the buildings DataFrame containing the information about the building category encoded as integer labels.
Methods
compute_plots
(plots[, ...])Compute plot-based characters
compute_slope
(raster)Compute slope-based characters
Extract data on a sightline point level.
Extract data on a street level.
Notes
momepy offers also a simplified way of anlysing streetscape using the
momepy.street_profile()
function. That is able to compute significantly less characters but is several orders of magnitude faster.Examples
Given only streets and buildings, you can already measure the majority of characters:
>>> sc = momepy.Streetscape(streets, buildings)
The resulting data can be extracted either on a street level:
>>> street_df = sc.street_level()
Or for all individual sightline points:
>>> point_df = sc.point_level()
If you have access to plots, you can additionally measure plot-based data:
>>> sc.compute_plots(plots)
If you have a digital terrain model, you can measure slope-based data:
>>> sc.compute_slope(dtm)
- __init__(streets, buildings, sightline_length=50, tangent_length=300, sightline_spacing=3, intersection_offset=0.5, angle_tolerance=5, height_col=None, category_col=None)[source]#
Streetscape analysis based on sightlines
Methods
__init__
(streets, buildings[, ...])Streetscape analysis based on sightlines
compute_plots
(plots[, ...])Compute plot-based characters
compute_slope
(raster)Compute slope-based characters
Extract data on a sightline point level.
Extract data on a street level.