Skip to content
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

Stop times > 23:59:59 unsearchable after midnight #23

Open
elliottwilliams opened this issue Jul 28, 2017 · 3 comments
Open

Stop times > 23:59:59 unsearchable after midnight #23

elliottwilliams opened this issue Jul 28, 2017 · 3 comments
Labels

Comments

@elliottwilliams
Copy link
Member

For example, this stop time:
75R10,24:02:00,24:02:00,PLZA,3,Warm Springs/South Fremont,,,,1

...cannot be found by this visits_between query:
timetable.visits_between("PLZA", "20170728 00:00:00", "20170728 00:30:00", 5)

This is because we start searching at day of the requested time.

@faultyserver
Copy link
Member

Nice catch. Just looking quickly, I think this could be resolved by simple changing the *_time members of gtfs::stop_time into resolved DateTimes.

The comparisons in the query functions are converting them into DateTimes anyway, so I don't see much of a performance hit. In fact, this could actually be a massive storage improvement (12 bytes per DateTime vs 17 bytes per string representation; 400k stop times would mean megabytes of RAM being saved, plus the indices could be optimized).

@elliottwilliams
Copy link
Member Author

The issue is that stop times don't actually have associated dates, they're based on the calendar date a trip is active.

@faultyserver
Copy link
Member

Right. Clearly I've been away from this for too long.

A naive solution (sans maybe trans-atlantic aquatic transit support) could be to start the date iteration 2-3 days before the given start date.

A less naive solution might iterate the stop times within the bounds of the query on the index and determine how far back the date needs to go.

I can't think of a better way that wouldn't at least double memory or run time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants