momepy.NodeDensity#
- 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
andnode_end
is standard output ofmomepy.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 ask-1
.- node_degreestr (optional)
The name of the column of
left
containing node degree. Used ifweighted=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.
- 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.
Examples
>>> nodes['density'] = mm.NodeDensity(nodes, edges, sw).series