AbstractA short list of responses and clarifications about Frequently Asked Questions from r5r users.
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.
r5r with custom modifications
to street nework data?
It is possible to edit the OpenStreetMap
.pbffile before using it in
r5rfor example to remove or add roads, change speeds etc etc. To to this, you can edit the
.pbffile with JOSM (https://wiki.openstreetmap.org/wiki/JOSM). Mind you that the the OpenStreetMap tags can be changed but they cannot be removed from the data.
detailed_itineraries()use different routing algorithms, as explained in the documentation of these functions. As such, we advise not to use or combine the output of these functions.
If you an error message says something like: “Geographic extent of street layer (5315196 km2) exceeds limit of 975000 km2”. This means the your study area is too large. Unfortunately, this is a limit hardcoded upstream in R5 so we cannot change it in r5r. The advised solution here would be to reduce the extent of the
OpenStreetMap.pbfto a smaller area of interest. One can do this using the Osmosis software. The code below illustrates how to do this by calling Osmosis from within R. You need to donwload the Osmosis program to your computer. The latest releases can be downloaded from here. Next, you can use this step-by-step illustrated in the example below:
# 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
# prepare call to osmosis
osmosis_cmd <- sprintf("%s --read-pbf %s --bounding-box left=%s bottom=%s right=%s top=%s --write-pbf %s",
area_bbox@xmin, area_bbox@ymin, area_bbox@xmax, area_bbox@ymax,
# call to osmosis
shell(osmosis_cmd, translate = TRUE)
By default, R5 considers the max speed limit of each road as set in OpenStreetMap data. Unfortunately, there is currently no easy way to change the car speeds of road segments from within R. Although you could probably do that by editing the osm.pbf file using other programs. See issue #289.
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_datetimeoutside the calendar of public transport operations in your GTFS data. Check the
calendar.txtfile 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.