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 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 [DPR+17].

Parameters
leftGeoDataFrame

GeoDataFrame containing nodes of street network

rightGeoDataFrame

GeoDataFrame containing edges of street network

spatial_weightslibpysal.weights

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)

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

node_startstr (default ‘node_start’)

name of the column of right gdf containing id of starting node

node_endstr (default ‘node_end’)

name of the column of right gdf containing id of 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

Series containing resulting values

leftGeoDataFrame

original left GeoDataFrame

rightGeoDataFrame

original right GeoDataFrame

node_startSeries

Series containing used ids of starting node

node_endSeries

Series containing used ids of ending node

swlibpysal.weights

spatial weights matrix

weightedbool

used weighted value

node_degreeSeries

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]

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

Methods

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

Initialize self.