Skip to contents

This function filters a set of bicycle routes by selecting routes that are spatially separated (based on start point distances) and ranked by a specified attribute. It's designed to identify optimal bike bus routes that don't overlap at their origins and maximize cycling potential.

Usage

filter_routes(
  routes,
  attribute_trips = c("bicycle_godutch", "quietness", "gradient_smooth"),
  buffer = 300,
  top_n = 3
)

Arguments

routes

An sf object containing route geometries with associated attributes. Must contain a geometry column and the specified attribute ranking column.

attribute_trips

Character string specifying which attribute to use for ranking routes. One of "bicycle_godutch", "quietness", or "gradient_smooth".

buffer

Numeric value specifying the minimum distance (in meters) between route start points. Routes with start points closer than this distance will be filtered out to avoid spatial overlap. Default is 300 meters.

top_n

Integer specifying the maximum number of routes to return after filtering and ranking. Default is 3.

Value

a dataset with the filtered routes

See also

cycle_bus_routes for creating route networks

Examples

if (FALSE) { # \dontrun{
cycle_bus_routes <- cycle_bus_routes(routes_almada)
filter_routes(cycle_bus_routes)
} # }