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 provided height_col),

  • hw: Height-to-Width Ratio [-] (if height data is provided height_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 and sb or 0/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 by right_* 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), and nodes_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]. When using the implementation, please cite [Araldi et al., 2025].

Parameters:
streets : gpd.GeoDataFrame

GeoDataFrame containing LineString geometry representing streets

buildings : gpd.GeoDataFrame

GeoDataFrame containing Polygon geometry representing buildings

sightline_length : float, optional

length of the sightline generated at each sightline point perpendiculary to the street geometry, by default 50

tangent_length : float, optional

length of the sightline generated at each sightline point tangentially to the street geometry, by default 300

sightline_spacing : float, optional

approximate distance between sightline points generated along streets, by default 3

intersection_offset : float, 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_tolerance : float, optional

Maximum angle between sightlines that does not require infill lines to be generated, by default 5

height_col : str, optional

name of a column of the buildings DataFrame containing the information about the building height in meters.

category_col : str, optional

name of a column of the buildings DataFrame containing the information about the building category encoded as integer labels.

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)

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.

Streetscape analysis based on sightlines

Methods

compute_plots(plots[, ...])

Compute plot-based characters

compute_slope(raster)

Compute slope-based characters

point_level()

Extract data on a sightline point level.

street_level()

Extract data on a street level.

compute_plots(plots, sightline_plot_depth_extension=300)[source]

Compute plot-based characters

Parameters:
plots : gpd.GeoDataFrame

plots represented as polygons

sightline_plot_depth_extension : float, optional

depth of the sightline extension, by default 300

Examples

>>> sc = momepy.Streetscape(streets, buildings)
>>> sc.compute_plots(plots)
compute_slope(raster)[source]

Compute slope-based characters

Requires Xarray and Xvec packages.

Parameters:
raster : xarray.DataArray

xarray.DataArray object (optimally read via rioxarray), supported by Xvec’s extract_points method, representing digital terrain model.

Examples

>>> sc = momepy.Streetscape(streets, buildings)
>>> sc.compute_slope(dtm)
point_level()[source]

Extract data on a sightline point level.

Returns:

GeoDataFrame with streetscape data linked to points representing origins of sightlines.

Return type:

geopandas.GeoDataFrame

Examples

>>> sc = momepy.Streetscape(streets, buildings)
>>> sc.point_level()
street_level()[source]

Extract data on a street level.

Returns:

GeoDataFrame with streetscape data linked to street geometry.

Return type:

geopandas.GeoDataFrame

Examples

>>> sc = momepy.Streetscape(streets, buildings)
>>> sc.steet_level()