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 street network
Number of elements within neighbourhood defined in
spatial_weights
. Ifspatial_weights
areNone
, it will assume topological distance0
(element itself). Ifmode='area'
, returns sum of areas of reached elements. Requires unique_id of network assigned beforehand (e.g. usingmomepy.get_network_id()
).\[\]- Parameters
- leftGeoDataFrame
GeoDataFrame containing streets (either segments or nodes)
- rightGeoDataFrame
GeoDataFrame containing elements to be counted
- left_idstr, list, np.array, pd.Series (default None)
the name of the left dataframe column,
np.array
, orpd.Series
where is stored ID of streets (segments or nodes).- right_idstr, list, np.array, pd.Series (default None)
the name of the right dataframe column,
np.array
, orpd.Series
where is stored ID of streets (segments or nodes).- spatial_weightslibpysal.weights (default None)
spatial weights matrix
- modestr (default ‘count’)
mode 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
Series containing resulting values
- leftGeoDataFrame
original left GeoDataFrame
- rightGeoDataFrame
original right GeoDataFrame
- left_idSeries
Series containing used left ID
- right_idSeries
Series containing used right ID
- modestr
mode of calculation
- swlibpysal.weights
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[, ...])