Skip to content

Generate a timetable.json based on frequencies for the use with osm2gtfs

License

Notifications You must be signed in to change notification settings

opentransitmap/frequency-timetable-generator

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Frequency Timetable Generator

This script generates timetable information for a bus system based on frequencies to a json suitable for the use with osm2gtfs.

Please make sure you use Python 3 to run it.

Use

  • Create a folder <folder> inside data and put an frequencies.csv and an header.json in it.
  • Create your frequencies.csv according to the following scheme, separated by commas:
    • ref = your public transport route number (as used in OSM, required)
    • from = the first stop (as in OSM, required)
    • to = the last stop (as in OSM, required)
    • via = an intermediate stop (as in OSM, required when present in OSM data)
    • intermediates = intermediate stop names (as in OSM), separated by a ; (not required)
    • opening-hours = opening hours, subset from the OSM opening_hours specification, should look like {Weekday(-{Weekday})} {start_hour:start_min}(-{end_hour:end_min}), for example Mo-Sa 07:15-12:30, Tu 15:15 or even Tu 12:30|14:00, separated by a ; (required)
    • exceptions = the dates (ISO 8601) which are excluded from the service, separated by a ; (not required)
    • duration = the time the public transport service needs to fulfill the route (required)
    • intermediate-durations = the time the public transport service needs from the first stop to the respective intermediate stop, separated by a ;, has to be exactly as long as the intermediates list (required, if intermediates is set)
    • frequency = number of minutes between public transport services on this route (required, but in the case opening-hours does not include time ranges it can be left blank)
  • The header.json file follows the specification here, without the lines and the updated keys
  • Run python3 convert.py -f <folder>

There is also an alternative method of expressing frequencies: by the times, the public transport service passes in one hour. This alternative approach can be used with the -h or --per_hour flag when running the script (but you have to be sure, that all the rows for frequency inside frequencies.csv follow this approach)

License

GNU GPLv3 Image

This program is Free Software: You can use, study share and improve it at your will. Specifically you can redistribute and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

About

Generate a timetable.json based on frequencies for the use with osm2gtfs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%