-
Notifications
You must be signed in to change notification settings - Fork 68
WIP: Export TimeTable to GTFS #337
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
Draft
PatrickSteil
wants to merge
24
commits into
motis-project:master
Choose a base branch
from
PatrickSteil:exportGTFS
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 14 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
64fff17
first draft
PatrickSteil 75f2b9e
seperate methods
PatrickSteil 06f4147
claude support
PatrickSteil a23595e
more work
PatrickSteil 5b5cff5
use format
PatrickSteil 3c0969d
want internal ids, but still collision
PatrickSteil 5212faf
more work, exports valid gtfs
PatrickSteil ac361fe
more work
PatrickSteil 9fa8aaf
include original id and feed info
PatrickSteil c23df36
Merge branch 'motis-project:master' into exportGTFS
PatrickSteil cdb29cc
add a comment to calendar.txt export
PatrickSteil 8872b70
remove tbb stuff from cmakelist
PatrickSteil f8d893a
sanitise and correct cast
PatrickSteil 0fcb029
escape commata
PatrickSteil 3cc79ff
incorperate some feedback
PatrickSteil 94a3860
warnings
PatrickSteil 4f0219b
stop_desc
PatrickSteil ae35b47
add curly brackets
PatrickSteil 7547738
Merge branch 'motis-project:master' into exportGTFS
PatrickSteil 83cf2a7
Merge branch 'motis-project:master' into exportGTFS
PatrickSteil a1136f6
work on parents
PatrickSteil cd3e0fe
add dummy agency url and name
PatrickSteil f52330f
Merge branch 'motis-project:master' into exportGTFS
PatrickSteil afb6c06
Merge branch 'motis-project:master' into exportGTFS
PatrickSteil File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| #include <filesystem> | ||
| #include <iostream> | ||
|
|
||
| #include "boost/program_options.hpp" | ||
|
|
||
| #include "nigiri/export_gtfs.h" | ||
| #include "nigiri/logging.h" | ||
| #include "nigiri/timetable.h" | ||
| #include "nigiri/types.h" | ||
|
|
||
| using namespace nigiri; | ||
|
|
||
| int main(int argc, char* argv[]) { | ||
| namespace bpo = boost::program_options; | ||
|
|
||
| auto tt_path = std::filesystem::path{}; | ||
| auto gtfs_dir = std::filesystem::path{}; | ||
|
|
||
| bpo::options_description desc("Allowed options"); | ||
| desc.add_options()("help,h", "produce this help message") // | ||
| ("tt_path,p", bpo::value(&tt_path)->required(), | ||
| "path to a binary file containing a serialized nigiri timetable") // | ||
| ("gtfs_export_dir,o", bpo::value(>fs_dir)->required(), | ||
| "path to the directory to export the timetable as GTFS"); | ||
| bpo::variables_map vm; | ||
| bpo::store(bpo::command_line_parser(argc, argv).options(desc).run(), vm); | ||
|
|
||
| if (vm.count("help") != 0U) { | ||
| std::cout << desc << "\n"; | ||
| return 0; | ||
| } | ||
|
|
||
| bpo::notify(vm); | ||
|
|
||
| std::cout << "loading timetable...\n"; | ||
| auto tt = *nigiri::timetable::read(tt_path); | ||
| tt.resolve(); | ||
|
|
||
| std::cout << "exporting timetable as GTFS...\n"; | ||
| export_gtfs(tt, gtfs_dir); | ||
| std::cout << "done.\n"; | ||
|
|
||
| return 0; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| #pragma once | ||
|
|
||
| #include <filesystem> | ||
|
|
||
| #include "nigiri/timetable.h" | ||
|
|
||
| namespace nigiri { | ||
|
|
||
| struct timetable; | ||
|
|
||
| // Skip the first 9 stops, bcs they are sentinels | ||
| constexpr int stopOffset{9}; | ||
|
|
||
| void export_gtfs(timetable const& tt, std::filesystem::path const& output_dir); | ||
|
|
||
| void write_feed_info(std::filesystem::path const& output_dir); | ||
|
|
||
| void write_agencies(timetable const& tt, | ||
| std::filesystem::path const& output_dir); | ||
|
|
||
| void write_stops(timetable const& tt, std::filesystem::path const& output_dir); | ||
|
|
||
| void write_stop_times(timetable const& tt, | ||
| std::filesystem::path const& output_dir); | ||
|
|
||
| void write_trips(timetable const& tt, | ||
| std::filesystem::path const& output_dir, | ||
| std::vector<size_t> const& route_offsets); | ||
|
|
||
| void write_routes(timetable const& tt, | ||
| std::filesystem::path const& output_dir, | ||
| std::vector<size_t> const& route_offsets); | ||
|
|
||
| void write_calendar(timetable const& tt, | ||
| std::filesystem::path const& output_dir); | ||
|
|
||
| void write_calendar_dates(timetable const& tt, | ||
| std::filesystem::path const& output_dir); | ||
|
|
||
| void write_transfers(timetable const& tt, | ||
| std::filesystem::path const& output_dir); | ||
|
|
||
| } // namespace nigiri |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.