momepy.NodeDensity#

class momepy.NodeDensity(left, right, spatial_weights, weighted=False, node_degree=None, node_start='node_start', node_end='node_end', verbose=True)[source]#

Calculate the density of nodes neighbours on street network defined in spatial_weights. Calculated as the number of neighbouring nodes / cummulative length of street network within neighbours. node_start and node_end is standard output of momepy.nx_to_gdf() and is compulsory.

Adapted from [Dibble et al., 2017].

Parameters
leftGeoDataFrame

A GeoDataFrame containing nodes of street network.

rightGeoDataFrame

A GeoDataFrame containing edges of street network.

spatial_weightslibpysal.weights

A spatial weights matrix capturing relationship between nodes.

weightedbool (default False)

If True, density will take into account node degree as k-1.

node_degreestr (optional)

The name of the column of left containing node degree. Used if weighted=True.

node_startstr (default ‘node_start’)

The name of the column of right containing the ID of the starting nodes.

node_endstr (default ‘node_end’)

The name of the column of right containing the ID of the ending node.

verbosebool (default True)

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

Examples

>>> nodes['density'] = mm.NodeDensity(nodes, edges, sw).series
Attributes
seriesSeries

A Series containing resulting values.

leftGeoDataFrame

The original left GeoDataFrame.

rightGeoDataFrame

The original right GeoDataFrame.

node_startSeries

A Series containing used ids of starting node.

node_endSeries

A Series containing used ids of ending node.

swlibpysal.weights

The spatial weights matrix.

weightedbool

The used weighted value.

node_degreeSeries

A Series containing used node degree values.

__init__(left, right, spatial_weights, weighted=False, node_degree=None, node_start='node_start', node_end='node_end', verbose=True)[source]#

Methods

__init__(left, right, spatial_weights[, ...])