-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to read gtfs nor reproduce an example #24
Comments
The first error:
indicates just what it says at the end. The command The remainder are repeats of this kind of pattern:
The first line is the actual code from My output from your code above: library (gtfsrouter)
if (!file.exists ("warsaw-gtfs.zip"))
download.file("https://mkuran.pl/feed/ztm/ztm-latest.zip", "warsaw-gtfs.zip")
gtfs <- extract_gtfs("warsaw-gtfs.zip")
#> Warning: This feed contains no transfers.txt
#> Warning in data.table::fread(cmd = paste0("unzip -p ", filename, " \"", :
#> Detected 7 column names but the data has 8 columns (i.e. invalid file). Added 1
#> extra default column name for the first column which is guessed to be row names
#> or an index. Use setnames() afterwards if this guess is not correct, or fix the
#> file write command that created the file to create a valid file.
#> Warning in data.table::fread(cmd = paste0("unzip -p ", filename, " \"", :
#> Discarded single-line footer: <<"Bus shapes (under ODbL licnese): ©
#> OpenStreetMap contributors",pl,0,0,1,1,"https://www.openstreetmap.org/
#> copyright">> Created on 2020-04-16 by the reprex package (v0.3.0) So it will read, but you won't be able to do any routing with it until a |
A rough go at constructing the lists of stops needed for a "transfers.txt" table. For each stop, this code gets all neighbouring stops that do not lie on the same services. stops <- gtfs$stops
# Get matrix of dists between all stops
d <- geodist::geodist (stops [, c ("stop_lon", "stop_lat")], measure = "haversine")
# join service numbers on to stop table, so we can select only those stops that
# are part of different services
stop_service <- gtfs$stop_times [, c ("trip_id", "stop_id")]
stop_service <- stop_service [!duplicated (stop_service), ]
stop_service$services <- gtfs$trips$service_id [match (stop_service$trip_id, gtfs$trips$trip_id)]
stop_service$trip_id <- NULL
stop_service <- stop_service [which (!duplicated (stop_service)), ]
transfers <- pbapply::pblapply (seq (nrow (stops)), function (i) {
stopi <- gtfs$stops$stop_id [i]
nbs <- gtfs$stops$stop_id [which (d [i, ] < 200)] # as first go, get all neighbouring stops within 200m
services <- unique (stop_service$services [stop_service$stop_id == stopi])
service_stops <- unique (stop_service$stop_id [stop_service$services %in% services])
nbs [which (!nbs %in% service_stops)]
}) That UPDATE: Slight change to code makes it much more efficient, reducing time to a few seconds |
Thanks for resposne.
if (!file.exists ("warsaw-gtfs.zip"))
download.file("https://mkuran.pl/feed/ztm/ztm-latest.zip", "warsaw-gtfs.zip")
unzip("warsaw-gtfs.zip") Created on 2020-04-16 by the reprex package (v0.3.0) I went through the code and the following is working as well library (gtfsrouter)
if (!file.exists ("warsaw-gtfs.zip"))
download.file("https://mkuran.pl/feed/ztm/ztm-latest.zip", "warsaw-gtfs.zip")
flist <- utils::unzip ("warsaw-gtfs.zip", list = TRUE) Created on 2020-04-16 by the reprex package (v0.3.0) The problem is here (I guess, with this: if (!file.exists ("warsaw-gtfs.zip"))
download.file("https://mkuran.pl/feed/ztm/ztm-latest.zip", "warsaw-gtfs.zip")
flist <- utils::unzip ("warsaw-gtfs.zip", list = TRUE)
f <- flist$Name[1]
fout <- data.table::fread (cmd = paste0 ("unzip -p ", "warsaw-gtfs.zip",
" \"", f, "\""),
integer64 = "character",
showProgress = FALSE)
#> Warning in (if (.Platform$OS.type == "unix") system else shell)
#> (paste0("(", : '(unzip -p warsaw-gtfs.zip "calendar_dates.txt") > C:
#> \Users\stepniak\AppData\Local\Temp\RtmpYziY2B\file1c50bb6157e' execution failed
#> with error code 1
#> Warning in data.table::fread(cmd = paste0("unzip -p ", "warsaw-gtfs.zip", : File
#> 'C:\Users\stepniak\AppData\Local\Temp\RtmpYziY2B\file1c50bb6157e' has size 0.
#> Returning a NULL data.table. Created on 2020-04-16 by the reprex package (v0.3.0) It seems that uzinp command in Windows is a bit problematic. I've spent couple of hours trying to solve it but unfortunately, I haven't found any solution. |
Ah, i see. That error has come up before, but i couldn't work it out (having no access to any windows machines). But now i get it. The above commit should fix things for you, so could you please install current version here: remotes::install_github("atfutures/gtfs-router") and let me know whether that works? That would be really helpful! And in regard to your other questions: This package does different things from those others, primarily through pre-processing the data ready to be used for routing. That happens somewhat behind the scenes, so the results of |
It works! |
Not currently, because there are actually very few systems that use that. Madrid is one of the only ones i've encountered. It's pretty straightforward to incorporate it, but there seems to be little demand to date - #13 is the issue, and has received no comments in the past year. That said, let me know if you need it, and i should hopefully be able to find time to incorporate that. |
Solved. |
Hello,
Unfortunately I am not able to reproduce an example from vignette:
Created on 2020-04-16 by the reprex package (v0.3.0)
I am not able to read this gtfs feed :
Created on 2020-04-16 by the reprex package (v0.3.0)
I attach my systemInfo:
Created on 2020-04-16 by the reprex package (v0.3.0)
And this:
Created on 2020-04-16 by the reprex package (v0.3.0)
It looks like I am missing something in my R settings but no idea what can it be. Do you have any hint about what should I look for? Thanks
The text was updated successfully, but these errors were encountered: