aggregate_points: Events aggregation

Description Usage Arguments Details Value Examples

Description

Function to aggregate points within a radius.

Usage

1
aggregate_points(points, maxdist, weight = "weight")

Arguments

points

The SpatialPointsDataFrame to contract (must have a weight column)

maxdist

The distance to use

weight

The name of the column to use as weight (default is "weight"). The values of the aggregated points for this column will be summed. For all the other columns, only the first value is retained.

Details

This function can be used to aggregate points within a radius. This is done by iterating over the features. For each feature, all the features in the radius are found and merged (mean of coordinates). This process is repeated until no more modification is applied.

Value

A new SpatialPointsDataFrame

Examples

1
2
3
4
eventsgpkg <- system.file("extdata", "events.gpkg", package = "spNetwork", mustWork = TRUE)
bike_accidents <- rgdal::readOGR(eventsgpkg,layer="bike_accidents", verbose=FALSE)
bike_accidents$weight <- 1
agg_points <- aggregate_points(bike_accidents, 5)

spNetwork documentation built on Oct. 30, 2021, 5:06 p.m.