momepy.SegmentsLength#

class momepy.SegmentsLength(gdf, spatial_weights=None, mean=False, verbose=True)[source]#

Calculate the cummulative and/or mean length of segments. Length of segments within set topological distance from each of them. Reached topological distance should be captured by spatial_weights. If mean=False it will compute sum of length, if mean=True it will compute sum and mean.

Parameters
gdfGeoDataFrame

A GeoDataFrame containing streets (edges) to analyse.

spatial_weightslibpysal.weights, optional

A spatial weights matrix. If None, Queen contiguity matrix will be calculated based on streets.

meanbool, optional
If mean=False it will compute sum of length, if mean=True

it will compute sum and mean.

verbosebool (default True)

If True, shows progress bars in loops and indication of steps.

Notes

The spatial_weights keyword argument should be based on index, not unique ID.

Examples

>>> streets_df['length_neighbours'] = mm.SegmentsLength(streets_df, mean=True).mean
Calculating spatial weights...
Spatial weights ready...
Attributes
seriesSeries

A Series containing resulting total lengths.

meanSeries

A Series containing resulting total lengths.

sumSeries

A Series containing resulting total lengths.

gdfGeoDataFrame

The original GeoDataFrame

swlibpysal.weights

The spatial weights matrix.

__init__(gdf, spatial_weights=None, mean=False, verbose=True)[source]#

Methods

__init__(gdf[, spatial_weights, mean, verbose])