momepy.Reached#

class momepy.Reached(left, right, left_id, right_id, spatial_weights=None, mode='count', values=None, verbose=True)[source]#

Calculates the number of objects reached within neighbours on a street network. The number of elements within neighbourhood defined in spatial_weights. If spatial_weights are None, it will assume topological distance 0 (element itself). If mode='area', returns sum of areas of reached elements. Requires a unique_id of network assigned beforehand (e.g. using momepy.get_network_id()).

Parameters:
leftGeoDataFrame

A GeoDataFrame containing streets (either segments or nodes).

rightGeoDataFrame

A GeoDataFrame containing elements to be counted.

left_idstr, list, np.array, pd.Series (default None)

The name of the left dataframe column, np.array, or pd.Series where the IDs of streets (segments or nodes) are stored.

right_idstr, list, np.array, pd.Series (default None)

The name of the right dataframe column, np.array, or pd.Series where the IDs of streets (segments or nodes) are stored.

spatial_weightslibpysal.weights (default None)

A spatial weights matrix.

modestr (default ‘count’)

Tode of calculation. If 'count' function will return the count of reached elements. If 'sum', it will return sum of 'values'. If 'mean' it will return mean value of 'values'. If 'std' it will return standard deviation of 'values'. If 'values' not set it will use of areas of reached elements.

valuesstr (default None)

The name of the objects dataframe column with values used for calculations.

verbosebool (default True)

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

Examples

>>> streets_df['reached'] = mm.Reached(streets_df, buildings_df, 'uID').series
Attributes:
seriesSeries

A Series containing resulting values.

leftGeoDataFrame

The original left GeoDataFrame.

rightGeoDataFrame

The original right GeoDataFrame.

left_idSeries

A Series containing used left ID.

right_idSeries

A Series containing used right ID.

modestr

The mode of calculation.

swlibpysal.weights

The spatial weights matrix (if set).

__init__(left, right, left_id, right_id, spatial_weights=None, mode='count', values=None, verbose=True)[source]#

Methods

__init__(left, right, left_id, right_id[, ...])