Skip to content

Configuration

Pablo Hoch edited this page Jun 1, 2021 · 2 revisions

MOTIS can be configured using command line arguments or a config file. By default, a config.ini file in the current working directory is used if it exists. A different config file can be specified using the -c path/to/config.ini option. Command line arguments override options specified in the config file.

For a list of all available options run motis --help.

Examples

NOTE: The examples on this page are for the current development version (Git master). See the project website for information on how to use the latest release version.

In the examples, /path/to/motis contains the MOTIS source code and /path/to/data is a directory where MOTIS will store generated data and log files. On Windows you can use the native path syntax, e.g. C:\path\to\motis.

Full setup with Web UI

config.ini:

[server]
static_path=/path/to/motis/ui/web

[import]
paths=schedule:/path/to/schedule
paths=osm:/path/to/osm-data.osm.pbf
data_dir=/path/to/data

[dataset]
begin=TODAY
# or: begin=YYYYMMDD (e.g. begin=20210531)
num_days=2

[osrm]
profiles=/path/to/motis/deps/osrm-backend/profiles/bus.lua
profiles=/path/to/motis/deps/osrm-backend/profiles/car.lua
profiles=/path/to/motis/deps/osrm-backend/profiles/bike.lua

[ppr]
profile=/path/to/motis/deps/ppr/profiles/default.json
# Optionally enable additional profiles:
#profile=/path/to/motis/deps/ppr/profiles/accessibility1.json
#profile=/path/to/motis/deps/ppr/profiles/wheelchair.json
#profile=/path/to/motis/deps/ppr/profiles/elevation.json

[tiles]
profile=/path/to/motis/deps/tiles/profile/background.lua

This example requires:

  • A timetable in a supported format
  • OpenStreetMap data for the schedule region in PBF format (.osm.pbf file): Can be downloaded from Geofabrik and other sources
  • The compiled Web UI
    • Enable the motis-web-ui target by running cmake -DMOTIS_WITH_WEBUI=ON ...
    • Build the Web UI by running ninja motis-web-ui (or follow the instructions in the web/ui directory)
    • Set the server.static_path option to the path of the web/ui directory

MOTIS will start an embedded web server, which by default listens on http://127.0.0.1:8080/ (see the server.host and server.port options).

By default, the routing module is used to answer routing queries. To use the tripbased module instead, set intermodal.router=tripbased:

[intermodal]
router=tripbased

Required modules for the Web UI:

  • Always: intermodal, guesser, address, lookup
  • At least one of (depending on intermodal.router setting): routing, tripbased
  • For the map: path, railviz, tiles, osrm (with bus profile)
  • For footpaths: ppr
  • For bike and car routes: osrm (with car and bike profiles), parking

Execute queries in batch mode

Assuming a config.ini with the basic settings (import paths, dataset options) already exists:

motis --mode batch --batch_input_file queries.txt --batch_output_file responses.txt

Or in config.ini:

# Only enable the required modules
modules=routing
modules=csa

# Batch mode
mode=batch
batch_input_file=queries.txt
batch_output_file=responses.txt

[import]
...

When mode=batch is set, MOTIS will not start a web server and instead read messages in JSON format (one message per line) from batch_input_file, execute them (in parallel) and write the responses to batch_output_file (JSON format, one message per line - not necessarily in the same order as the queries in the input file, but with matching message IDs).

See Tools for a list of included tools for working with messages.

Tips

Only enable the required modules

You can either specify a list of modules to compile in the CMake Options or specify a list of modules to load at runtime in the configuration.

For example, to only load the routing and tripbased modules, at the top of your config.ini (before any [] blocks) add:

modules=routing
modules=tripbased

By default all modules are enabled. Alternatively to only disable some modules, use exclude_modules.

Schedule Graph Cache

Set dataset.cache_graph to 1 to enable the schedule graph cache. This will store the initial schedule graph in a file and load that file on subsequent runs instead of rebuilding the graph, which reduces the start up time. This only works as long as the dataset settings remain unchanged. The cache files are written to a schedule directory in the data path.

NOTE: Don't use this option if you make changes to the core of MOTIS, e.g. changes to the graph builder. Delete the cache files and/or disable the option in case of problems.