--- title: 'FAQ - Frequently Asked Questions' date: "`r Sys.Date()`" output: rmarkdown::html_vignette abstract: "A short list of responses and clarifications about Frequently Asked Questions from r5r users." urlcolor: blue vignette: > %\VignetteIndexEntry{FAQ - Frequently Asked Questions} %\VignetteEngine{knitr::rmarkdown} \usepackage[utf8]{inputenc} --- ```{r, include = FALSE} knitr::opts_chunk$set( collapse = TRUE, comment = "#>", eval = identical(tolower(Sys.getenv("NOT_CRAN")), "true"), out.width = "100%" ) ``` # 1. Why do some trips from/to the same ID have travel times larger than zero?
click to expand > This can happen when the input point is distant to any routable road segment. In this case, R5 will snap the point to the closest road segment that can be traversed with the selected transport mode, and it will consider that the person would walk in Euclidean distance from the input point to the snapped location. So R5 is accounting for this walking time "as the crow flies" in the routing.
# 2. Is it possible to run `r5r` with custom modifications to street network data?
click to expand > Yes, all routing and accessibility functions in `r5r` have the parameters `new_carspeeds`, `carspeed_scale` and `new_lts` which allow one to use custom car speeds and LTS levels for cycling. These parameters provide convenient and efficient ways to build different scenarios of traffic congestion, road closure and interventions in cycling infrastructure. [See this vignette](https://ipea.github.io/r5r/articles/scenarios.html). For other changes to the OSM network (e.g. including a new road link), you would need to edit the OpenStreetMap `.pbf` file directly before using it in `r5r`. To do this, you can edit the `.pbf` file with [JOSM (https://wiki.openstreetmap.org/wiki/JOSM)](https://wiki.openstreetmap.org/wiki/JOSM). OpenStreetMap tags can be changed but not removed.
# 3. Why are the output results of `travel_time_matrix()` and `detailed_itineraries()` different?
click to expand > `travel_time_matrix()` (and `expanded_travel_time_matrix()`) and `detailed_itineraries()` compute different things, as explained in the documentation of these functions. `detailed_itineraries()` returns the fastest itinerary over the time window rather than a percentile of travel times, and it routes the walk or bike legs to and from public transport with separate street searches for each origin-destination pair (`travel_time_matrix()` uses precomputed street times between stops and destinations). With `shortest_path = FALSE` or a `fare_structure`, it also uses a different routing algorithm (McRAPTOR), which simulates departures at random seconds. As such, we advise not to combine the output of these functions.
# 4. What does the ERROR "Geographic extent of street layer exceeds limit" mean? and what to do about it?
click to expand > An error like *"Geographic extent of street layer (5315196 km2) exceeds limit of 975000 km2"* means your study area is too large. The limit is hardcoded in R5, so r5r cannot change it. The **solution** is to crop the `OpenStreetMap.pbf` to your area of interest, e.g. with [Osmosis](https://wiki.openstreetmap.org/wiki/Osmosis). Download the [latest Osmosis release](https://github.com/openstreetmap/osmosis/releases), then call it from R: ``` # get the bounding box of your study area study_area_polygon <- geobr::read_state(code_state = "ES") area_bbox <- sf::st_bbox(study_area_polygon) # input: the path to osmosis and the large pbf file in your local computer osmosis_path <- "./osmosis_dir/bin/osmosis.bat" large_pbf_path <- "./project_dir/large.pbf" # path where you want to save the smaller .pbf file smaller_pbf <-"./project_dir/smaller.pbf" # prepare call to osmosis osmosis_cmd <- sprintf("%s --read-pbf %s --bounding-box left=%s bottom=%s right=%s top=%s --write-pbf %s", osmosis_path, large_pbf_path, area_bbox["xmin"], area_bbox["ymin"], area_bbox["xmax"], area_bbox["ymax"], smaller_pbf) # call to osmosis shell(osmosis_cmd, translate = TRUE) ```
# 5. Is it possible to use custom car speed data with r5r?
click to expand > Yes. By default, R5 considers the max speed limit of each road as set in OpenStreetMap data. You can change car speeds from within R with the `new_carspeeds` and `carspeed_scale` parameters of the routing functions. [See this vignette](https://ipea.github.io/r5r/articles/scenarios.html).
# 6. Why do I get identical results by public transport and walking?
click to expand > If your travel time / accessibility results are identical for public transport and walking, it is probably because R5 did not detect that the public transport network is available for your requested trips. This is likely to occur in case you set a `departure_datetime` outside the calendar of public transport operations in your GTFS data. Check the `calendar.txt` file in your gtfs.zip feed. Alternatively, this could occur because there is no public transport trip option that would be faster than walking for the given origin-destination pair you queried.