Comments (3)
This is how the current code works, stepping inside each function:
devtools::load_all (".", export_all = TRUE)
#> Loading gtfsrouter
gtfs <- extract_gtfs ("vbb.zip")
#> ▶ Unzipping GTFS archive
#> ✔ Unzipped GTFS archive
#> ▶ Extracting GTFS feed✔ Extracted GTFS feed
#> ▶ Converting stop times to seconds✔ Converted stop times to seconds
#> ▶ Converting transfer times to seconds✔ Converted transfer times to seconds
gtfs <- gtfs_timetable (gtfs)
#> Day not specified; extracting timetable for Monday
stn <- "Berlin, Rohrdammbrücke"
start_time <- 3600
end_time <- start_time + 600
#x <- gtfs_isochrone (gtfs, from = stn, start_time = start_time, end_time = end_time)
# code from gtfs_isochrone function:
from <- stn
from_is_id <- FALSE
gtfs_cp <- data.table::copy (gtfs)
start_time <- convert_time (start_time)
end_time <- convert_time (end_time)
gtfs_cp$timetable <- gtfs_cp$timetable [departure_time >= start_time, ]
start_stns <- station_name_to_ids (from, gtfs_cp, from_is_id)
start_stns
#> [1] 492 27286 28339
#isotrips <- get_isotrips (gtfs_cp, start_stns, start_time, end_time)
# code from get_isotrips function:
stns <- rcpp_csa_isochrone (gtfs$timetable, gtfs$transfers,
nrow (gtfs$stop_ids), nrow (gtfs$trip_ids),
start_stns, start_time, end_time)
stns
#> [[1]]
#> [1] 27286 27287 28819 27345 27346 27347 33326 33328 33330
#>
#> [[2]]
#> [1] 25933 25933 25933 25933 25933 25933 50413 50413 50413
#>
#> [[3]]
#> [1] 27286 27287 28819 27345 27346 27347 27348 27293 27294
#>
#> [[4]]
#> [1] 25933 25933 25933 25933 25933 25933 25933 46653 46653
#>
#> [[5]]
#> [1] 27286 27287 28819 27345 28559 29453 30470 28844 29376
#>
#> [[6]]
#> [1] 25933 25933 25933 25933 45673 45673 45673 45673 45673
#>
#> [[7]]
#> [1] 27286 27287 28819 27345 27346 27347 27348 27293 27319
#>
#> [[8]]
#> [1] 25933 25933 25933 25933 25933 25933 25933 46653 25933
#>
#> [[9]]
#> [1] 20820
Created on 2020-06-22 by the reprex package (v0.3.0)
So most of the work happens in the C++ function rcpp_csa_isochrone
, which returns paired lists of vectors denoting (stations along each route, corresponding trip numbers). (There is an additional item, here [[9]]
, which records the start time in seconds.) This C++ code would thus need to be modified to add the arrival time at each of those sequences of stations. The stations are ultimately stored here:
https://github.com/ATFutures/gtfs-router/blob/c7ba288609aaa28a4c826c2272544f73ee0bb6ff/src/csa-isochrone.cpp#L160-L161
With those values of prev_stn
constructed here:
https://github.com/ATFutures/gtfs-router/blob/c7ba288609aaa28a4c826c2272544f73ee0bb6ff/src/csa-isochrone.cpp#L122-L123
... alongside equivalent values for prev_time
. So all that we'd need to do would be to add an additional output vector for prev_time
alongisde prev_stn
, and then append that to the result as you suggest. Not sure how your C++ skills are @AlexandraKapp? Let me know if you feel up for the challenge, otherwise i'm happy to address it.
from gtfsrouter.
Thanks for looking into it! I'm afraid I cannot really offer C++ skills - so that would probably take me a bit to get into that.
from gtfsrouter.
No worries - I'll be happy to get on to it, after #14 is done.
from gtfsrouter.
Related Issues (20)
- no results when calculating gtfs_traveltimes() HOT 2
- SVG version of the logo HOT 8
- Allow start times to be vector of times for each station HOT 1
- Bug in traveltimes algorithm HOT 1
- Update documentation to include example for gtfs_route with (lon, lat) please HOT 3
- Move atfutures -> UrbanAnalyst
- Proportion of trips on different route_types HOT 4
- rcpp_csa | Not compatible with requested type HOT 3
- Reduce ratios of user / elapsed times in examples HOT 2
- Fix pkg man entry
- CRAN UBSAN issues
- CRAN re-submit HOT 2
- pkgcheck results - main HOT 8
- Alternative approach to build a transfer table HOT 8
- Using gtfs_traveltimes for many-to-many calculations HOT 6
- gtfs_traveltimes bug when setting max_traveltime HOT 5
- route_table does not generate fastest travel HOT 3
- Issues with gtfs_transfer_table() when running on MacOS HOT 3
- gtfs_route randomly crashes the session HOT 2
- gtfs_traveltimes output HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gtfsrouter.