Skip to content
Nico Alt edited this page Oct 19, 2017 · 2 revisions

Make it work for your city

All work needs to be done exclusively in the creators directory. Directly in this directory are the standard creators located. Those creators contain the logic to convert osm2gtfs' objects of Line, Itinerary and Stop and add them to the transitfeed schedule object. Each of the creators refer to the creation of the different GTFS parts:

  • agency_creator.py: Prepares and add the data for the generation of the GTFS agency.txt
  • feed_info_creator.py: Prepares and add the data for the generation of the GTFS feed_info.txt
  • routes_creator.py: Prepares and add the data for the generation of the GTFS routes.txt
  • stops_creator.py: Prepares and add the data for the generation of the GTFS stops.txt
  • trips_creator.py: Prepares and add the data for the generation of the GTFS trips.txt, stop_times.txt and shapes.txt.

You can override any of those standard creators by creating a new directory with the name you specified freely as selector in the configuration file. Inside this directory copy the creator file you want to override and append a _ and the name of the selector, like for example stops_creator_fenix.py. Inside this file you can then extend the part to your liking. Please make sure to copy over the almost empty __init__.py in order to make the override work properly.

The core

Usually it is not necessary to dive deeper into the core. However this documentation also provides a quick overview of this essential part of osm2gtfs. The code lives in the core directory.

  • cache.py: Contains logic to cache the queried and downloaded data from OpenStreetMap.
  • configuration.py: Reads the configuration file, validates some information, creates a configuration object which is getting passed along the other parts of the program.
  • creator_factory.py: Contains the logic for the extension of creators as described on how to make osm2gtfs work for your city.
  • debug.py: Contains functions for different levels of debug messages, warnings and errors and how these can be exposed.
  • osm_connector.py: Contains the functionality to query OpenStreetMap using it's Overpass API and store convert the data to objects of the classes Line, Itinerary, Stop and StopArea.
  • routes.py: Contains the definition of the classes Line and Itinerary.
  • stops.py: Contains the definition of the class Stop and StopArea.
Clone this wiki locally