Major changes
travel_time_matrix(), arrival_travel_time_matrix(), accessibility() and pareto_frontier() are 2 to 7 times faster (bicycle-only 2.5 to 4 times), and detailed_itineraries() with public transport and no fare_structure is 2 to 4 times faster. Details in the minor changes below.Bug fixes
options(java.parameters = "-Xmx...") before library(r5r) was ignored since r5r v2.2.0, so Java always ran with its default maximum heap (a quarter of the machine's RAM, capped at about 30 GB). The memory limit and any other Java options set by the user now take effect again.travel_time_matrix(), expanded_travel_time_matrix() and arrival_travel_time_matrix() returned from_id and to_id swapped with walk-only routing, no elevation data and fewer origins than destinations (introduced in r5r 2.4.0). Closes again #501.sf objects that also carried lon/lat (or x/y) attribute columns were routed using those attribute columns instead of the point geometry. The geometry is now always used.travel_time_matrix(), arrival_travel_time_matrix() and expanded_travel_time_matrix() wrote CSV files with from_id and to_id swapped (and named after the destinations) when output_dir was used with walk-only routing, no elevation data and more origins than destinations. This is fixed, but such runs with output_dir may now take longer.percentiles are now sorted in ascending order internally. Unsorted values (e.g. c(75, 25)) used to crash inside R5 with an uninformative Java error.lon/lat coordinates now trigger a warning listing the affected ids. They used to be dropped silently.id values now raise an error in all one-to-many functions, instead of returning ambiguous duplicated rows. detailed_itineraries() keeps accepting repeated ids in row-paired inputs (all_to_all = FALSE).FERRY was missing from the list of transit modes that trigger the check for transit services on the departure date.max_car_time now caps car-only trips, as max_walk_time and max_bike_time already did for walk-only and bike-only trips. It used to apply only to car access/egress legs of transit trips.accessibility() with the logistic, exponential and linear decay functions ignored every trip longer than max(cutoffs), although these curves still give weight to such trips, so accessibility was underestimated. max_trip_duration is now capped by max(cutoffs) only for the step function (the cap was introduced in r5r 2.1.0, #348). Results of the other decay functions change and are now larger.accessibility() now accepts fractional opportunity values (e.g. population interpolated onto a grid). They used to be truncated to integers, so any value below 1 counted as 0. Missing values are treated as 0, now with a warning, and infinite values raise an error.cutoffs in accessibility() are now validated (whole numbers between 1 and 120, no duplicates) and sorted in ascending order. Unsorted or out-of-range values used to crash inside R5 with an uninformative Java error, and duplicated values returned duplicated rows.accessibility(), the decay_value of the linear decay function is now required to be a whole number of minutes between 1 and 59. Fractional values used to be silently truncated by R5, and values of 60 or more crashed inside R5.detailed_itineraries() reported transfer-walk durations that differed from those used to find and rank itineraries. On networks built with elevation data this could give impossible timelines (e.g. 40 minutes to walk 119 m followed by a normal wait), itineraries longer than max_trip_duration and, with shortest_path = TRUE, an option that was not the shortest. Transfer walks now take walking distance / walk_speed, consistent with travel_time_matrix() and expanded_travel_time_matrix().detailed_itineraries(), transfer walks from or to the first stop of the transit network had a straight-line geometry and distance and no OSM or edge ids. They are now routed on the street network like all other transfers.output_dir did not quote text values, so any value containing a comma broke the file. This made every file written by detailed_itineraries() unreadable (its WKT geometry and its osm_id_list / edge_id_list columns always contain commas), and broke the files of any routing function when an id or route name contained a comma. Such values are now quoted following the CSV standard (RFC 4180); files without such values are unchanged.detailed_itineraries() with output_dir silently overwrote the file of a repeated origin-destination pair (allowed since row-paired inputs may repeat ids), and crashed with a Java error on ids containing characters not allowed in file names (e.g. /). It now raises an informative error in both cases.detailed_itineraries() with zero-row origins or destinations crashed inside Java. It now returns an empty result.new_carspeeds, carspeed_scale or new_lts) had been applied left that scenario, and the other routing settings of the call, active in the routing engine, so the next call silently returned scenario results. All routing functions now reset the routing settings when they exit, including on error.max_fare passed without a fare_structure now raises an error instead of being silently ignored.pareto_frontier() failed when called without fare_cutoffs, because its default (-1) was rejected by the function's own check that cutoffs are 0 or more. Without a fare_structure it ran but ignored fares, so its output was not a Pareto frontier. Both fare_structure and fare_cutoffs are now required arguments, with an informative error when either is missing. Code that passed fare_structure = NULL (or left it out) now raises an error.max_walk_time, max_bike_time, max_car_time, max_trip_duration, time_window, percentiles, n_threads, max_rides, max_lts, draws_per_minute, cutoffs, suboptimal_minutes, and zoom in isochrone()) now reject non-integer values instead of silently truncating them.isochrone() were shifted by half a grid cell to the north-west (about 94 m at the default zoom = 10 in Porto Alegre), because R5's travel times, computed at the centre of each Web Mercator pixel, were placed at the pixel's corner. Polygons are now in the right place.isochrone(), the polygon of the largest cutoff was cut short, so its size depended on the other cutoffs requested (e.g. the 30-minute transit isochrone was up to 19% smaller with cutoffs = 30 than with cutoffs = c(30, 60)). It is now complete, so the largest polygons get larger (routing now runs 10 minutes past the largest cutoff).isochrone() (polygon_output = FALSE) assigned segments to the wrong band when cutoffs were not in ascending order, and crashed with duplicated cutoffs. cutoffs are now sorted and deduplicated, and must be finite, non-missing and include a value greater than 0.isochrone() now returns an id column with the origin id, so results for several origins can be told apart. The id column is now always character in both outputs (it used to keep the input type in polygon output), and the st_centroid warning on every line-based call is gone.arrival_travel_time_matrix() searched departures in the wrong time window for walk-, bike- or car-only trips when max_walk_time, max_bike_time or max_car_time was lower than max_trip_duration. Trips arrived well before arrival_datetime (e.g. with mode = "WALK", max_trip_duration = 120 and max_walk_time = 20, departures between 12:00 and 12:19 for an arrival at 14:00, instead of between 13:40 and 13:59).build_network() now detects and aborts with an informative message when a cached network.dat triggers a silent internal rebuild that fails on high priority GTFS errors, instead of silently returning an unusable r5r_network that only fails later with an opaque NullPointerException on the first routing call.output_dir, the CSV files written by travel_time_matrix(), expanded_travel_time_matrix() and arrival_travel_time_matrix() held 2147483647 and a [WALK] route for trips longer than max_trip_duration, where the in-memory result has NA. These cells are now empty fields, so the files match the in-memory result.expanded_travel_time_matrix() and arrival_travel_time_matrix() failed with walk-only routing, no elevation data and more than 5000 origins, even with 5000 or fewer destinations (R5's limit for path details). This now works.java.lang.RuntimeException.expanded_travel_time_matrix() and arrival_travel_time_matrix() mixed up public transport trips departing at exactly 00:00:00 with walk-, bike- or car-only trips: the first minute returned extra rows with an empty departure_time. Each departure minute now has one row per draw.arrival_travel_time_matrix() stopped searching earlier departures at the first minute with no trip, so pairs that could still arrive in time by leaving earlier were missing (7 of 221 pairs among the Porto Alegre points of interest). It also compared arrivals using durations rounded to 0.1 minute, which accepted trips up to 3 seconds late and could reject trips arriving on time; it now uses the exact duration.detailed_itineraries() repeated a vertex at every intermediate public transport stop (and in some walk legs), so sf::st_is_valid() returned FALSE under s2. Repeated consecutive vertices are now removed; shapes and distance are unchanged.Minor changes
travel_time_matrix(), expanded_travel_time_matrix(), arrival_travel_time_matrix(), accessibility() and pareto_frontier() is 2.5 to 4 times faster in a benchmark of this change alone (part of the overall gain in Major changes), as r5r no longer runs an unneeded search on foot. Bicycle results are unchanged. Car-only trips can no longer end with a walk not limited by max_walk_time (e.g. against a one-way street), so some car travel times are now longer (3% of origin-destination pairs in the Porto Alegre sample data, by 1 to 8 minutes), now consistent with isochrone().travel_time_matrix(), expanded_travel_time_matrix() and arrival_travel_time_matrix() return large results faster: passing an all-to-all matrix of the Porto Alegre sample grid (1.47 million rows) from Java to R went from 0.76 to 0.13 seconds. Results are unchanged.detailed_itineraries() with public transport and no fare_structure is about 1.5 times faster with max_trip_duration = 60, 2.4 times faster with time_window = 30, and about 4 times faster with the defaults (max_trip_duration = 120, shortest_path = TRUE), and uses less memory. The itineraries returned are unchanged, except that with suboptimal_minutes > 0 the option numbers of two itineraries with exactly the same duration and number of segments can be swapped. Routing with a fare_structure is unchanged.r5r_core argument is now the last argument of every function. It used to be the second one, so positional calls such as travel_time_matrix(r5r_network, origins, destinations) bound origins to r5r_core and failed with a misleading deprecation warning and error.carspeed_scale defaults to 1 (not NULL), and the unsupported modes BICYCLE_RENT and CAR_PARK were removed from the list of transport modes.detailed_itineraries() now lists the output columns and how itinerary options are ordered, and describes the osm_link_ids columns correctly (board_stop_id and alight_stop_id are feed-prefixed GTFS stop ids, not OSM ids; edge_id_list is also added). It also explains that shortest_path = TRUE picks the itinerary with the shortest travel time among all departures within time_window (not the earliest arrival), and that suboptimal_minutes requires shortest_path = FALSE and no fare_structure.detailed_itineraries() and the time window vignette now explain how time_window and suboptimal_minutes select itineraries. Departures are simulated at random seconds (about one per minute, the same in every call from the same origin) and routed separately, and for each departure only routes arriving within suboptimal_minutes of the earliest arrival are kept, even if a slower route has fewer transfers. As a result, an itinerary can appear or disappear when the departure time changes by one minute. Closed #534.arrival_travel_time_matrix() now describes its output correctly (one row per pair reachable in time, with the latest departure; other pairs are absent), explains that max_trip_duration also sets the search window, and documents "24:MM:SS" departure times after midnight and the whole-minute precision of walk-, bike- or car-only trips.expanded_travel_time_matrix() now lists the output columns, explains routes, that the breakdown = TRUE time components are 0 for trips without public transport, why a pair can be NA in every minute and why a few trips just over max_trip_duration are NA here although travel_time_matrix() reports them, and no longer claims that time_window results use median travel times or that breakdown = TRUE is significantly slower.isochrone() now describes the Web Mercator grid method, the output columns (polygon bands are cumulative, line bands are intervals), the right defaults of mode and progress, and that max_trip_duration is ignored (set from max(cutoffs)); the isochrones vignette was corrected to match.fixed_exponential decay function in accessibility() now states that its decay constant is applied to travel times in seconds, so per-minute constants must be divided by 60.Major changes
isochrone() function has gone through major changes which substantially
improved polygon-based isochrones. The function now builds on top of a travel
time surface that uses a regular grid of points across the network (specifically
a grid of Web Mercator pixels) and then uses the marching squares algorithm to
generate the isochrone polygons. See detailed in the updated vignette. Closed
#455 and Closed #495.get_gtfs_errors() to help diagnose eventual errors in
the GTFS data that prevent building the network. Closed #431 and #541.Minor changes
check_transit_availability() that checks the number and
proportion of public transport services from the GTFS feeds that are active on
specified dates.street_network_bbox() that efficiently extracts the
geographic bounding box of the transport network.Bug fixes
in travel_time_matrix(), arrival_travel_time_matrix() and expanded_travel_time_matrix().
Closes #501.New contributors to r5r
Major changes
build_network() to replace setup_r5(), which is being deprecated. Idiomatically r5r_core is now r5r_network.arrival_travel_time_matrix() to calculate travel time matrix between origin destination pairs considering the time of arrival, instead of a depature time. Closes #291travel_time_matrix(), expanded_travel_time_matrix() and arrival_travel_time_matrix(). In practice, this means that these functions are now much faster when there are multiple origins to few destinations but only when there is no elevation .tif file in the data path. Closes #450r5r have new parameters new_carspeeds, carspeed_scale and new_lts which allow one to use custom car speeds and LTS levels for cycling. These parameters provide convient and efficient ways to build different scenarios of traffic congestion, road closure and interventions in cycling infrastructure. Closes #289Minor changes
build_network() and setup_r5() now have their own class "r5r_network", making the package more consistent and safer from errors #472.Verbose=F now completly silences java output. Verbose=T only reports messages up to INFO level as opposed to up to DEBUG #456.options(r5r.r5jar=...) to use a local JAR instead of the R5 jar downloaded by r5r.Bug fixes
network_settings.json wasn't showing the right version numbers #459. Version number now dynamically updated #456.New co-authors
Major changes
detailed_itineraries() now has a new parameter osm_link_ids. A logical. Whether the output should include the additional columns with the OSM ids of the road segments used along the trip geometry Defaults to FALSE. Closes issues #298Minor changes
r5rlog file in the data path.Bug fixes
New contributors
Minor changes
isochrone() function has a new boolean parameter polygon_output that allows users to choose whether the output should be a polygon- or line-based isochrone. Closed #382Breaking changes
Major changes
tools::R_user_dir()r5r_cache() to manage the cache of the R5 Jar file.Minor changes
accessibility() function, the value of max_trip_duration is now capped by the max value passed to the cutoffs parameter. Closes #348.max_walk_time to make it clear that in walk-only trips, whenever max_walk_time differs from max_trip_duration, the lowest value is considered. Closes #353max_bike_time to make it clear that in bicycle-only trips, whenever max_bike_time differs from max_trip_duration, the lowest value is considered. Closes #353suboptimal_minutes in the detailed_itineraries() function.detailed_itineraries() function.Bug Fixes
output_dir parameter in the detailed_itineraries(all_to_all = TRUE) function. Closes #327 with a contribution (PR #354) from Luyu Liu.detailed_itineraries from working with frequency-based GTFS feeds. It should ONLY work with frequency-based GTFS feeds.New contributors to r5r
Major changes
isochrone()function. Closes #123, and addresses requrests in issues #164 and #328.r5r.r5r users.Minor changes
time_window is not set to 10 minutes in all functions to avoid weird results reported upstream in R5. Closes #342.percentiles parameter in the expanded_travel_time_matrix() because this function does not expose this parameter to users. Closes #343.r5r.Bug fixes
Breaking changes
max_walk_dist and max_bike_dist parameters with max_walk_time and max_bike_time to better align with R5 inputs. Closes #273.r5r now uses R5's native elevation weighting for walking and cycling impedance functions. As a result r5r does not have raster or rgdal package dependencies anymore. Closes #243 and #233.breakdown and breakdown_stat in travel_time_matrix() were removed. New function expanded_travel_time_matrix() should be used to retrieve detailed information of travel time matrices.r5rnow throws an error if users simultaneously pass more than one of the following modes c('WALK','CAR','BICYCLE') to the transport_mode parameter. This is because these modes are understood as mutually exclusive.setup_r5() no longer has a version parameter.New functions
expanded_travel_time_matrix() to calculate minute-by-minute travel times between origin destination pairs and get additional information on public transport routes, number of transfers, and total access, waiting, in-vehicle and transfer times.pareto_frontier() to compute of travel time and monetary cost Pareto frontier.r5r_sitrep() to generate an r5r situation report to help debug code errorssetup_fare_structure() to setup a fare structure to calculate the monetary costs of tripsread_fare_structure() to read a fare structure object from a filewrite_fare_structure() to write a fare structure object to diskMajor changes
6.8.detailed_itineraries() has been substantially improved. The new vesion is faster than previous ones. It also includes new parameters listed below. Closes #265.
time_window parametersuboptimal_minutes parameter, which extends the search space and returns a larger number of trips beyond the fastest ones;max_fare parameter;draws_per_minute to travel_time_matrix(), accessibility() and pareto_frontier() functions. Closes #230.output_dir to all routing functions, which can be used to specify a directory in which the results should be saved as .csv files (one file for each origin). This parameter is particularly useful when running estimates on memory-constrained settings, because writing the results to disk prevents R5 from storing them in memory.accessibility() are now of returned as doubles / class numeric, except when using a step decay function. Closes #235.detailed_itineraries() function has a new parameter all_to_all, which allows users to set whether they want to query routes between all origins to all destinations (all_to_all = TRUE) or to query routes between the 1st origin to the 1st destination, then the 2nd origin to the 2nd destination, and so on (all_to_all = FALSE, the default). Closes #224.Minor changes
cutoffs parameter in accessibility(), clarifying the function only accepts up to 12 cutoff values. Closes #216.percentiles parameter in accessibility() and travel_time_matrix(), clarifying these function only accepts up to 5 values. Closes #246.verbose = FALSE and progress = FALSE by default.street_network_to_sf(). Closes #251.Bug fixes
transit_network_to_sf() generated some routes with invalid geometries. Closes #256.setup_r5(path, overwrite = TRUE) to work.Minor change
Major changes
r5r.montecarlo_draws option. Defaults to 5. This would mean 300 draws in a 60 minutes time window, for example. The user may also set a custom value using options(r5r.montecarlo_draws = 10L) (in which you substitute 10L by the value you want to set).Minor changes
total_time column name to combined_time in travel_time_matrix()
output, to avoid confusion with travel_time column.Major changes
Updated R5 to version 6.4. Closes #182.
Significant performance improvements in all functions, due to a faster method for consolidating outputs. Closes #180
New function transit_network_to_sf(), to extract the public transport network
from R5 as simple features. Closes #179
New progress parameter in the accessibility(), travel_time_matrix, and
detailed_itineraries() functions, to show or hide the progress counter
indicator. Closes #186
Created new support function java_to_dt() and removed dependency on the jdx package. Closes #206
Reduced r5r's internet dependency quite considerably. Internet is now only required to download the latest R5 jar if it hasn't been downloaded before. Closes #197.
Added two new parameters breakdown and breakdown_stat to the travel_time_matrix(). This allows users to breakdown the travel time information by trip subcomponents (access time, waiting time, traveling time etc). It allows one to extract more information but it makes computation time slower. Closes #194
Minor changes
setup_r5() parameter, overwrite, that forces the building of a new network.dat, even if one already exists.departure_datetime to clarify the parameter must be set to local time. Closes #188transit_network_to_sf() regarding stops that are not snapped to road network. Closes #192.max_walking_dist and max_cycling_dist parameters. Closes #193.Major changes
New function accessibility() to calculate access to opportunities. Closes #169
New function find_snap() to help users identify where in the street network the input of origin and destination points are snapped to. Closes 168.
New parameter max_bike_dist added to routing and accessibility functions. Closes #174
Implemented temporary solution for elevation. Closes #171. Now r5r can read Digital Elevation Model (DEM) data from raster files in .tif format to weight the
street network for walking and cycling according to the terrain's slopes. Ideally, we would like to see a solution that accounts for elevation implemented upstream in R5. For now, this is a temporary solution implemented within r5r.
Minor changes
The street_network_to_sf() now has a more clean output when the provided GTFS covers a larger area than the street network pbf. Closes #173
The size of poa.zip sample GTFS data has been reduced due to CRAN policies. Closes #172.
Progress counter Implemented. Closes 150. When the verbose parameter is set to FALSE, r5r prints a progress counter and eventual ERROR messages. This comes with a minor penalty for computation performance. Hence we have kept verbose defautls to TRUE.
Bug fixes
Major changes
max_lts parameter to detailed_itineraries() and travel_time_matrix() functions. LTS stands for Level of Traffic Stress, and allows modeling of bicycle comfort in routing analysis. Additional information can be found in Conveyal's documentation.Minor changes
check_connection() to check internect connection before
download files from Ipea server.Major changes
detailed_itineraries() when
shortest_path = TRUE. Closes #153.Minor changes
travel_time_matrix() and detailed_itineraries() now output more detailed
messages in the console, when verbose = TRUE. This shall make debugging the
package much easier.travel_time_matrix(). Closes #149.id column. Closes #154.Bug fixes
{geobr} package when downloading metadata. Closed #137.departure_datetime in detailed_itineraries() and travel_time_matrix(). Closes #147.detailed_itineraries() that caused a crash when the shape of a route in the input GTFS is broken. Closes #145Minor changes
Minor changes
mode_egress to routing functions, so that users can
explicitly set the transport mode used after egress from public transport (walk,
car or bicycle). Closed #63.setup_r5() before.Major changes
Minor changes
percentiles parameter in the travel_time_matrix function now only accepts up to 5 cut points due to changes in R5.Minor changes
travel_matrix_function when the user
sets time_window parameter. Closes #127.detailed_itinerariesMajor changes
travel_time_matrix now has new parameters time_window and
percentiles it now calculates travel times for multiple departure times each
minute within a given time window. For now, the function automatically set the
number of Monte Carlo Draws to 5 times the size of time_window. Closes #104
and #118Minor changes
Minor changes