momepy.SegmentsLength

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

Calculate the cummulative 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 return total length, if mean=True it will return mean value.

Parameters
gdfGeoDataFrame

GeoDataFrame containing streets (edges) to analyse

spatial_weightslibpysal.weights, optional

spatial weights matrix - If None, Queen contiguity matrix will be calculated based on streets (note: spatial_weights shoud be based on index, not unique ID).

meanboolean, optional

If mean=False it will return total length, if mean=True it will return mean value

Examples

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

Series containing resulting values

gdfGeoDataFrame

original GeoDataFrame

swlibpysal.weights

spatial weights matrix

meanboolean

used mean boolean value

__init__(self, gdf, spatial_weights=None, mean=False)[source]

Initialize self. See help(type(self)) for accurate signature.

Methods

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

Initialize self.