Skip to content

v2.5.0

Latest

Choose a tag to compare

@rafapereirabr rafapereirabr released this 08 Nov 22:40
· 6 commits to master since this release
0c98b25

Major changes

  • Faster routing 1. Compared with r5r 2.4.0 on the Porto Alegre and São Paulo sample data, car-only travel_time_matrix(), arrival_travel_time_matrix(), accessibility() and pareto_frontier() are 2 to 4 times faster, bicycle-only routing 1.3 to 2.8 times, and expanded_travel_time_matrix() 1.5 to 2.6 times. Public transport routing in these functions takes about as long as before.
  • Faster routing 2. detailed_itineraries() with shortest_path = TRUE (the default) and no fare_structure now routes public transport with R5's RAPTOR algorithm, as travel_time_matrix() does, instead of McRAPTOR. It is 28 to 225 times faster on the Porto Alegre sample data, with the same output columns. See #603. Results can differ slightly:
    • departures are routed every minute of time_window instead of at random seconds;
    • transfer walks are limited by max_walk_time;
    • GTFS pickup_type / drop_off_type restrictions are respected;
    • ties between equally fast trips may resolve to a different route.
    • Alternative routes (shortest_path = FALSE) and fares still use McRAPTOR, and a pair that RAPTOR cannot route falls back to McRAPTOR. Closed #464.
  • New seed argument in travel_time_matrix(), expanded_travel_time_matrix(), arrival_travel_time_matrix(), accessibility(), isochrone(), travel_time_surface() and pareto_frontier(). It makes the random departure offsets of frequency-based GTFS routes, and the departure times McRAPTOR samples within time_window, reproducible across runs and n_threads. The default seed = NULL keeps random draws. In expanded_travel_time_matrix() the trips of each minute are now numbered by total travel time, so arrival_travel_time_matrix() returns the fastest trip of the latest departure that arrives in time. Closes #593. See #597.
  • Uses R5 v7.6. Less than 1% of origin-destination pairs change on the Porto Alegre sample data, mostly with shorter public transport times. See #598:
    • stops and points are linked to the nearest street even along long segments;
    • transfer_time (with breakdown = TRUE) is now R5's transfer walking time, and waiting at the transfer stop is counted in wait_time;
    • get_gtfs_errors() names some files without the .txt extension.
    • Networks built with earlier versions are rebuilt automatically.
  • r5r requires R >= 4.1.0.

Bug fixes

  • Java memory set with options(java.parameters = "-Xmx...") before library(r5r) was ignored since r5r 2.2.0. It takes effect again.
  • With McRAPTOR (a fare_structure, pareto_frontier(), detailed_itineraries() with shortest_path = FALSE), almost every origin was routed at the same departure times within time_window. This was caused by an overflow in R5's random seed (conveyal/r5#1026). Each origin now gets its own reproducible sample, so results change slightly. Closes #601.
  • accessibility() with the logistic, exponential and linear decay functions ignored trips longer than max(cutoffs), which underestimated accessibility. Only the step function now caps max_trip_duration at max(cutoffs).
  • #549 Public transport routing now requires an explicit departure_datetime, since results depend on it. Without public transport, the current time is used. arrival_travel_time_matrix() requires arrival_datetime for all modes. Closed #486.
  • pareto_frontier() now requires fare_structure and fare_cutoffs. Without fare_cutoffs it failed, and without fare_structure it ignored fares.
  • Origins/destinations with duplicated ids raise an error in one-to-many functions. Repeated ids are still allowed in detailed_itineraries() with all_to_all = FALSE.
  • A finite max_fare without a fare_structure raises an error instead of being ignored.
  • travel_time_matrix(), expanded_travel_time_matrix() and arrival_travel_time_matrix() swapped from_id and to_id with walk-only routing and no elevation data, both in memory (fewer origins than destinations, a regression in 2.4.0, #501) and in output_dir files (more origins than destinations).
  • arrival_travel_time_matrix():
    • for walk-, bike- or car-only trips with max_walk_time, max_bike_time or max_car_time below max_trip_duration, it searched the wrong departure window;
    • it stopped searching at the first minute without a trip, missing pairs that could still arrive in time (#586);
    • it compared arrivals using rounded durations (#586).
  • expanded_travel_time_matrix() and arrival_travel_time_matrix() mixed up transit trips departing at 00:00:00 with street-only trips, and failed with walk-only routing and more than 5000 origins (#586).
  • detailed_itineraries():
    • transfer walks took a duration different from the one used for routing, giving impossible timelines on networks with elevation data; they now take distance / walk_speed;
    • transfer walks at the first stop had straight-line geometries;
    • leg geometries repeated vertices, so they were invalid under s2 (#586);
    • egress legs now keep the final partial street segment and the connection to the destination, with costs on the correct street endpoint (#607). Results can change, mainly for destinations on long street segments;
    • zero-row origins or destinations return an empty result instead of crashing.
  • isochrone():
    • polygons were shifted half a grid cell to the north-west;
    • the polygon of the largest cutoff was cut short, so it depended on the other cutoffs; it is now complete and larger;
    • line-based output (polygon_output = FALSE) assigned segments to the wrong band with unsorted cutoffs;
    • line-based output now returns an id column, id is always character, and the st_centroid warning is gone.
  • #578 A call that failed after applying a scenario (new_carspeeds, carspeed_scale, new_lts) left it active for the next call. Routing settings are now reset on exit, including on error.
  • Output files (output_dir)
    • Text values containing commas are quoted (RFC 4180). This fixes every detailed_itineraries() file, whose geometry, osm_id_list and edge_id_list columns always contain commas.
    • Trips longer than max_trip_duration are empty fields, as NA in memory, instead of 2147483647 (#586).
    • detailed_itineraries() raises an error for repeated origin-destination pairs, which overwrote each other, and for ids that are not valid file names.

Minor changes

  • r5r is dual-licensed under GPL (>= 3) | MIT + file LICENSE.
  • The repository moved to https://github.com/ipea/r5r. #569 fixes the source links on the website. Closed #527.
  • accessibility() accepts fractional opportunities instead of truncating them to integers. Missing values count as 0 with a warning, and infinite values raise an error.
  • Progress (#596):
    • progress defaults to TRUE in all routing functions;
    • the counter is printed by R, so it shows in every console, and reports every 1% of origins;
    • isochrone() no longer ignores progress.
  • #596 Routing can be interrupted with Esc / Ctrl+C. The "Using cached R5 version" message now shows only with verbose = TRUE.
  • #594 check_transit_availability() finds the operating dates, including calendar exceptions, when no dates are given.
  • Large matrices are passed from Java to R about 6 times faster.
  • McRAPTOR itineraries in detailed_itineraries() are found faster and with less memory. With suboptimal_minutes > 0, the option numbers of two exactly tied itineraries can be swapped.
  • Logging when building networks with several GTFS feeds (#571) and in the direct trip router (#568, closed #557).
  • Integer arguments (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()) reject non-integer values instead of truncating them.
  • max_car_time now caps car-only trips, not only the car legs of transit trips. Car-only trips can no longer end with a walk unbounded by max_walk_time, so 3% of car travel times on the Porto Alegre sample are 1 to 8 minutes longer, now consistent with isochrone().
  • Input combinations that R5's McRAPTOR cannot handle now raise informative errors instead of hanging, running out of memory or failing with a cryptic Java error (#602):
    • too many departure draws for time_window with a fare_structure (e.g. 8 draws per minute in 10 minutes, or the default 5 in 150 minutes or more);
    • exactly 200 draws (e.g. time_window = 200 in pareto_frontier()).
  • percentiles and cutoffs are sorted, and cutoffs are validated (whole numbers from 1 to 120, no duplicates). They used to crash inside R5 or duplicate rows.
  • The linear decay decay_value must be a whole number of minutes from 1 to 59.
  • Missing lon/lat now trigger a warning listing the affected ids, instead of being dropped silently.
  • Java errors reach R with their original message instead of an empty RuntimeException (#586).
  • #572 build_network() aborts with an informative message when a cached network.dat is rebuilt and fails on high-priority GTFS errors. Before, it returned an unusable network.
  • sf origins/destinations that also had lon/lat (or x/y) columns were routed at those columns instead of the point geometry.