route_risk | R Documentation |
Calculating the risk per route
route_risk(routes, crash_data, radius = 5)
routes |
The routes travelled by the commuter with the associated weight or number of travellers. This is an sf dataframe where the geometry a sfc LINESTRING. |
crash_data |
An sf dataframe containing the geometry of the crash sites. Geometry requires a projected coordinate system. |
radius |
The distance between the route and crash point. The default is 10. The unit of measure is dependent on input sf dataframes CRS. |
returns an sf dataframe with linestring geometry from routes input and a new column, crash_within_5m, the total number of crash sites encountered by each route.
## Not run: data(jtw_driving_akl) data(cas_data_akl_2018_proj) ## initialising the router for New Zealand ghroute::router(osm.file = "osm/new-zealand-latest.osm.pbf") ##getting the routes jtw_akl_routes <- get_routes(as.matrix(jtw_driving_akl[c("start_lat", "start_lon", "end_lat", "end_lon")]), crs = 2193) route_riskiness_d_proj <- route_risk(jtw_akl_routes, cas_data_akl_2018_proj) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.