No description
Find a file
2023-10-06 12:17:20 +02:00
.github/workflows remote ubuntu 18.04 from workflows 2023-04-03 21:09:52 +02:00
cmake add libzip include dirs 2022-10-12 12:40:56 +02:00
geo * speed up hop-to-hop calculations 2022-01-04 17:19:27 +01:00
src update util 2023-10-06 12:17:20 +02:00
.dockerignore Travis CI: build & publish Docker image 💚 2020-12-02 13:53:50 +01:00
.gitignore initial commit 2018-06-09 17:14:08 +02:00
.gitmodules update repo URL 2021-11-09 12:01:49 +01:00
.travis.yml move os condition to condition clause 2020-12-03 14:44:14 +01:00
.ycm_extra_conf.py initial commit 2018-06-09 17:14:08 +02:00
CMakeLists.txt bz2 support for OSM reading and writing 2023-08-24 17:29:01 +02:00
cpplint.py Explicitly use python 2 in shebang, fixes #3 2019-04-08 12:38:38 +02:00
Dockerfile add Dockerfile & .dockerignore 2020-12-02 13:53:29 +01:00
LICENSE license 2018-06-12 16:11:04 +02:00
pfaedle.cfg adjust defaults 2022-03-09 17:11:09 +01:00
push-docker-image.sh add docker pw and uname 2020-12-02 19:26:40 +01:00
README.md update readme 2023-08-24 17:35:22 +02:00

Left: station-to-station path of a single train through Switzerland obtained from schedule timetable data. Right: path of the same train map-matched by pfaedle. Left: station-to-station path of a single train through Switzerland obtained from official schedule data. Right: path of the same train map-matched by pfaedle.

Left: station-to-station path of a single bus through Stuttgart obtained from official schedule data. Right: path of the same bus map-matched by pfaedle. Left: station-to-station path of a single bus through Stuttgart obtained from official schedule data. Right: path of the same bus map-matched by pfaedle.

Build

pfaedle

Precise OpenStreetMap (OSM) map-matching for public transit schedules (GTFS data). First described in this 2018 SIGSPATIAL paper.

For a quick visual inspection of the shape quality, see for example the schedule data for Germany or Switzerland in our tool TRAVIC.

Requirements

  • cmake
  • gcc >= 5.0 (or clang >= 3.9)
  • libzip (optional, for ZIP support)
  • zlib (optional, for gzip support)
  • libbz2 (optional, for bzip2 support)

Building and Installation

Fetch this repository and init submodules:

git clone --recurse-submodules https://github.com/ad-freiburg/pfaedle
mkdir build && cd build
cmake ..
make -j

To install, type

make install

General Usage

Generating shapes for a GTFS feed

pfaedle -x <OSM FILE> <GTFS INPUT FEED>

A shape'd version of the input GTFS feed will be written to ./gtfs-out.

By default, shapes are only calculated for trips that don't have a shape in the input feed. To drop all existing shapes, use the -D flag.

For example, you may generate (and replace existing, see -D flag) shapes for the GTFS dataset for Freiburg like this:

$ wget https://fritz.freiburg.de/csv_Downloads/VAGFR.zip
$ wget http://download.geofabrik.de/europe/germany/baden-wuerttemberg/freiburg-regbez-latest.osm.bz2
$ pfaedle -D -x freiburg-regbez-latest.osm.bz2 VAGFR.zip

Generating shapes for a specific MOT

To generate shapes for a specific mot only, use the -m option. Possible values are either tram, bus, coach, rail, subway, ferry, funicular, gondola, all (default) or GTFS route type codes (0, 1, 2, 3, 4, 5, 6, 7, or extended route types). Integer codes will only match the specific route type, while string codes will match classes of route types. For example, -m 101 will only match routes with route_type 101 (high speed rail), while -m rail will match any rail service encoded via a standard route_type 2 or an extended route_type describing a rail service (e.g. 100, 101, 102, ...).

Multiple values can be specified (comma separated).

OSM filtering

pfaedle comes with the ability to filter OpenStreetMap data. If you specify the -X flag, pfaedle will filter the input OSM file and output a new OSM file which contains exactly the data needed to calculate the shapes for the input GTFS feed and the input configuration.

This can be used to avoid parsing (for example) the entire planet.osm on each run.

via Docker

You can use the adfreiburg/pfaedle Docker image by mounting the OSM & GTFS data into the container:

docker run -i --rm \
	# mount OSM data
	--volume /path/to/osm/data:/osm \
	# mount GTFS data
	--volume /path/to/gtfs/data:/gtfs \
	# tell pfaedle where to find the data
	adfreiburg/pfaedle -x /osm/osm-data.xml -i /gtfs

Debugging

The following flags may be useful for debugging:

  • -T <GTFS TRIP ID> only calculate shape for a single trip (specified via its GTFS trip id) and output it as GeoJSON to <dbg-path>/path.json
  • --write-graph write the graph used for routing as GeoJSON to
  • --write-trgraph write the complete network graph to <dbg-path>/trgraph.json

Configuration

A default configuration file pfaedle.cfg can be found in this repo and will be installed with make install. Custom configuration files can be specified with the -c flag. If no -c flag is set, pfaedle will parse and merge the following cfg files in the given order (if present): <install prefix>/etc/pfaedle/pfaedle.cfg, $HOME/.config/pfaedle/pfaedle.cfg, <CWD>/pfaedle.cfg. Values given in later files will overwrite earlier defined values.