features_within¶
features_within
¶
features_within(points: DataFrame, features: DataFrame, *, radius_m: float = 300.0, category_col: str | None = None, feature_lat: str = 'lat', feature_lon: str = 'lon', prefix: str = 'n_') -> DataFrame
Summarise the features around each point: the generic "what's nearby" primitive.
Works for any point dataset (transit stops, OSM POIs, shops, …). For every row of
points it counts features within radius_m and the distance to the nearest one;
with category_col it also breaks the count down per category (n_<category>).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
points
|
DataFrame
|
Query points with |
required |
features
|
DataFrame
|
Surrounding things, with |
required |
radius_m
|
float
|
|
300
|
category_col
|
str
|
A column in |
None
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
|
See Also
GeoKDTree : The spatial index underneath.
station_surroundings : A ready-made buffer summary.
stations_near : Find the stations themselves.