ipeaGIT / r5r

https://ipeagit.github.io/r5r/
Other
178 stars 27 forks source link

Check if input date is covered in the GTFS feed #326

Open rafapereirabr opened 1 year ago

rafapereirabr commented 1 year ago

1) Briefly describe your problem and what output you expect

Problem

Every now and then, a user opens a new issue saying that r5r doest not output results accounting for the transit network. Fast forward, we help the user realize they were using a departure date that is outside the GTFS calendar. This has been a common issue in r5py, so they are implementing a simple input check.

Output expected

If user routes with a transit mode, we could test whether the date falls inside the calendar of the GTFS feeds used to build the network. If the input date falls outside the calendar, the function should throw and error with an informative message.

To make this work, it would be ideal if we could extract the start and end dates information of the service calendar cooked into the network built with setup_r5(). Something like this:

start <- r5r_core$service.calendar.start_date

end <- r5r_core$service.calendar.end_date

And then we can use this info to check against the departure_datetime input. @mvpsaraiva , is it possible to expose the r5r_core$service.calendar to R ?

rafapereirabr commented 1 year ago

@mvpsaraiva , is it simple to expose r5r_core$service.calendar.start_date from the Java side ?

rafapereirabr commented 6 months ago

If there are any potential contributors who know Java and who might want to have a look at this, we would appreciate PR from collaborators