momepy.Reached#
- 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
. Ifspatial_weights
areNone
, it will assume topological distance0
(element itself). Ifmode='area'
, returns sum of areas of reached elements. Requires aunique_id
of network assigned beforehand (e.g. usingmomepy.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
, orpd.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
, orpd.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.
- 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).
Examples
>>> streets_df['reached'] = mm.Reached(streets_df, buildings_df, 'uID').series