UrbanAnalyst / gtfsrouter

Routing and analysis engine for GTFS (General Transit Feed Specification) data
https://urbananalyst.github.io/gtfsrouter/
81 stars 17 forks source link

accept stop_id as well as stop_name #26

Closed mpadge closed 4 years ago

mpadge commented 4 years ago

plus solve this issue:

library(gtfsrouter)
gtfs <- extract_gtfs ("vbb.zip") # local Berlin VBB feed
gtfs <- gtfs_timetable (gtfs)
#> Day not specified; extracting timetable for Wednesday
set.seed (3)
from <- sample (gtfs$stops$stop_name, 1)
to <- sample (gtfs$stops$stop_name, 1)
message (from, " -> ", to)
#> Frankfurt (Oder), EuroCamp -> Groß Fredenwalde
gtfs_route (gtfs, from = from, to = to)
#> Error in station_name_to_ids(from, gtfs_cp): Frankfurt (Oder), EuroCamp does not match any stations

Created on 2020-06-17 by the reprex package (v0.3.0)

It's in the stops table, so has to be recongised as a station.

mpadge commented 4 years ago

That commit fixes the problem above, which was because the "(" is an escape character, so grep-ing has to use fixed = TRUE to interpret the "(" as is.