momepy.Count¶
-
class
momepy.
Count
(left, right, left_id, right_id, weighted=False)[source]¶ Calculate the number of elements within an aggregated structure.
Aggregated structure can be typically block, street segment or street node (their snapepd objects). Right gdf has to have unique id of aggregated structure assigned before hand (e.g. using
momepy.get_network_id()
). Ifweighted=True
, number of elements will be divided by the area of length (based on geometry type) of aggregated element, to return relative value.\[\sum_{i \in aggr} (n_i);\space \frac{\sum_{i \in aggr} (n_i)}{area_{aggr}}\]Adapted from [HRRCambraLopez12] and [Fel18].
- Parameters
- leftGeoDataFrame
GeoDataFrame containing aggregation to analyse
- rightGeoDataFrame
GeoDataFrame containing objects to analyse
- left_idstr
name of the column where is stored unique ID in left gdf
- right_idstr
name of the column where is stored unique ID of aggregation in right gdf
- weightedbool (default False)
if
True
, count will be divided by the area or length
Examples
>>> blocks_df['buildings_count'] = mm.Count(blocks_df, ... buildings_df, ... 'bID', ... 'bID', ... weighted=True).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
- weightedbool
used weighted value
-
__init__
(left, right, left_id, right_id, weighted=False)[source]¶ Initialize self. See help(type(self)) for accurate signature.
Methods
__init__
(left, right, left_id, right_id[, …])Initialize self.