Skip to content

Installation and Setup

Felix Gündling edited this page May 12, 2024 · 12 revisions

This sets up the release version of MOTIS. MOTIS release distribution is downloaded, not built locally. For a developer setup see the other piki pages.

There are different options to start MOTIS:

  • Docker (on any system that supports Docker)
  • Linux binary
  • Windows binary
  • Mac OS X binary

Best practice is to setup MOTIS with two separate folders (aka "volumes" for Docker):

  • data folder/volume (MOTIS needs read+write access), this folder will contain preprocessed data, logs and temporary files
  • input folder/volume (MOTIS needs read-only access), this folder will contain input data such as OpenStreetMap data, timetables, coastline data, SRTM data, etc.

For each target platfrom (Docker, Linux, Windows, Mac OS), the first step is to create an input folder with the data you want to use for your server. This is typically

  • an OpenStreetMap file in the *.osm.pbf format (region extracts can be downloaded from Geofabrik.
  • one or more timetables (ZIP files need to be extracted). Supported timetable formats are at the moment GTFS and HAFAS Rohdaten.
  • and a config.ini pointing MOTIS to the data in the input folder as well as configuring MOTIS

You can save one of the following scripts as setup.sh and run it with sh setup.sh (or chmod +x setup.sh && ./setup.sh). Note: the following scripts delete files from previous runs (see first section). So make sure you run this script in a fresh folder.

Unix Setup - Mac OS X and Linux (executable)

The following script demonstrates a simple intermodal routing setup with MOTIS on Linux using the MOTIS executable. Make sure you have wget installed (preinstalled on many systems).

#!/bin/sh

# TARGET="macos-x86_64"
# TARGET="macos-x86_64-noavx2"
# TARGET="macos-arm64"
TARGET="linux-amd64"
# TARGET="linux-amd64-noavx"
# TARGET="linux-arm"
# TARGET="linux-arm64"
# TARGET="linux-x86"

# Download and extract MOTIS.
wget https://github.com/motis-project/motis/releases/latest/download/motis-${TARGET}.tar.bz2
tar xf motis-${TARGET}.tar.bz2

# Download a small test dataset from Aachen, Germany
wget https://github.com/motis-project/test-data/raw/aachen/aachen.osm.pbf
wget http://opendata.avv.de/archive_GTFS/2023/2023-10/AVV_GTFS_mit_SPNV_20231028.zip

# Write config.ini
cat <<EOT >> config.ini
modules=intermodal
modules=address
modules=tiles
modules=osrm
modules=ppr
modules=parking
modules=nigiri

intermodal.router=nigiri
server.static_path=motis/web

[import]
paths=schedule-avv:AVV_GTFS_mit_SPNV_20231028.zip
paths=osm:aachen.osm.pbf

[osrm]
profiles=motis/osrm-profiles/car.lua
profiles=motis/osrm-profiles/bike.lua

[ppr]
profile=motis/ppr-profiles/default.json

[tiles]
profile=motis/tiles-profiles/background.lua
EOT

# Start MOTIS
./motis/motis

Windows Setup

$Version = "v0.10.1"

# Clear data from previous runs.
Remove-Item -Recurse -Force -Confirm:$false motis
Remove-Item -Recurse -Force -Confirm:$false test-data-aachen
Remove-Item -Recurse -Force -Confirm:$false input
Remove-Item -Recurse -Force -Confirm:$false motis-windows.zip
Remove-Item -Recurse -Force -Confirm:$false aachen.zip
Remove-Item -Recurse -Force -Confirm:$false data

# Download and extract MOTIS. Change URL for other CPU architecture / OS.
Invoke-WebRequest https://github.com/motis-project/motis/releases/download/$Version/motis-windows.zip -OutFile motis-windows.zip
Expand-Archive motis-windows.zip -DestinationPath motis

# Download a small test dataset from Aachen, Germany
# This includes the timetable + OSM region extract for the core-city only.
Invoke-WebRequest https://github.com/motis-project/test-data/archive/refs/heads/aachen.zip -OutFile aachen.zip
Expand-Archive aachen.zip -DestinationPath .

# Create input folder.
New-Item -Type Directory input/schedule
Expand-Archive test-data-aachen/AVV_HAFAS_520.zip -DestinationPath input/schedule
Move-Item -Force test-data-aachen/zeitvs input/schedule
Move-Item test-data-aachen/aachen.osm.pbf input/osm.pbf

# Create config file
$Config = @"
modules=intermodal
modules=address
modules=tiles
modules=osrm
modules=ppr
modules=parking
modules=nigiri

intermodal.router=nigiri
server.static_path=motis/web

[import]
paths=schedule-avv:AVV_GTFS_mit_SPNV_20231028.zip
paths=osm:aachen.osm.pbf

[osrm]
profiles=motis/osrm-profiles/car.lua
profiles=motis/osrm-profiles/bike.lua

[ppr]
profile=motis/ppr-profiles/default.json

[tiles]
profile=motis/tiles-profiles/background.lua
"@ 
Out-File -FilePath input/config.ini -InputObject $Config -Encoding utf8 -Force

# Start MOTIS
./motis/motis -c input/config.ini