Skip to main content

Journey planner with RAPTOR algorithm

Project description

PyRaptor

Python implementation of RAPTOR and McRAPTOR using GTFS data. Tested on Dutch GTFS data.

This repository contains four applications:

  1. pyraptor/gtfs/timetable.py - Extract the timetable information for one operator from a GTFS dataset and write it to an optimized format for querying with RAPTOR.
  2. pyraptor/query_raptor.py - Get the best journey for a given origin, destination and desired departure time using RAPTOR
  3. pyraptor/query_range_raptor.py - Get a list of the best journeys to all destinations for a given origin and desired departure time window using RAPTOR
  4. pyraptor/query_mcraptor.py - Get a list of the Pareto-optimal journeys to all destinations for a given origin and a departure time using McRAPTOR
  5. pyraptor/query_range_mcraptor.py - Get a list of Pareto-optimal journeys to all destinations for a given origin and a departure time window using McRAPTOR

Installation

Install from PyPi using pip install pyraptor or clone this repository and install from source using pip.

Example usage

1. Create timetable from GTFS

python pyraptor/gtfs/timetable.py -d "20211201" -a NS --icd

2. Run (range) queries on timetable

Quering on the timetable to get the best journeys can be done using several implementations.

RAPTOR query

RAPTOR returns a single journey with the earliest arrival time given the query time.

Examples

python pyraptor/query_raptor.py -or "Arnhem Zuid" -d "Oosterbeek" -t "08:30:00"

python pyraptor/query_raptor.py -or "Breda" -d "Amsterdam Centraal" -t "08:30:00"

rRAPTOR query

rRAPTOR returns a set of best journeys with a given query time range. Journeys that are dominated by other journeys in the time range are removed.

Examples

python pyraptor/query_range_raptor.py -or "Arnhem Zuid" -d "Oosterbeek" -st "08:00:00" -et "08:30:00"

python pyraptor/query_range_raptor.py -or "Breda" -d "Amsterdam Centraal" -st "08:00:00" -et "08:30:00"

McRaptor query

McRaptor returns a set of Pareto-optimal journeys given multiple criterions, i.e. earliest arrival time, fare and number of trips.

Examples

python pyraptor/query_mcraptor.py -or "Breda" -d "Amsterdam Centraal" -t "08:30:00"

python pyraptor/query_mcraptor.py -or "Vlissingen" -d "Akkrum" -t "08:30:00"

python pyraptor/query_mcraptor.py -or "Obdam" -d "Akkrum" -t "08:30:00" -r 7

rMcRaptor query

Range version of McRaptor, i.e. it returns a set of Pareto-optimal journeys within a departure time window.

Examples

python pyraptor/query_range_mcraptor.py -or "Breda" -d "Amsterdam Centraal" -st "08:15:00" -et "08:30:00"

python pyraptor/query_range_mcraptor.py -or "Vlissingen" -d "Akkrum" -st "08:15:00" -et "08:30:00"

python pyraptor/query_range_mcraptor.py -or "Obdam" -d "Akkrum" -st "08:00:00" -et "09:00:00"

Notes

  • The current version doesn't implement target pruning as we are interested in efficiently querying all targets/destinations after running RAPTOR algorithm.

References

Round-Based Public Transit Routing, Microsoft.com, Daniel Delling et al

Raptor, another journey planning algorithm, Linus Norton

Dutch GTFS feed, Transit Feeds

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyraptor-1.3.10.tar.gz (20.2 kB view details)

Uploaded Source

Built Distribution

pyraptor-1.3.10-py3-none-any.whl (26.9 kB view details)

Uploaded Python 3

File details

Details for the file pyraptor-1.3.10.tar.gz.

File metadata

  • Download URL: pyraptor-1.3.10.tar.gz
  • Upload date:
  • Size: 20.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.3 readme-renderer/35.0 requests/2.28.1 requests-toolbelt/0.9.1 urllib3/1.26.10 tqdm/4.64.0 importlib-metadata/4.12.0 keyring/23.7.0 rfc3986/2.0.0 colorama/0.4.5 CPython/3.8.13

File hashes

Hashes for pyraptor-1.3.10.tar.gz
Algorithm Hash digest
SHA256 7c4602e0cdbea3e8c5f34f8b1c3715a06bc296c44719b33e2e1fc3783596e2ea
MD5 a7e98293a3194b86931a6a1471ad9826
BLAKE2b-256 6881b0c1ba4019c992a7e703c127139e6bd6832e814dcfcc9deb0506c09b9269

See more details on using hashes here.

File details

Details for the file pyraptor-1.3.10-py3-none-any.whl.

File metadata

  • Download URL: pyraptor-1.3.10-py3-none-any.whl
  • Upload date:
  • Size: 26.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.3 readme-renderer/35.0 requests/2.28.1 requests-toolbelt/0.9.1 urllib3/1.26.10 tqdm/4.64.0 importlib-metadata/4.12.0 keyring/23.7.0 rfc3986/2.0.0 colorama/0.4.5 CPython/3.8.13

File hashes

Hashes for pyraptor-1.3.10-py3-none-any.whl
Algorithm Hash digest
SHA256 b4acf62a921b8d3a0bec45ab20d366a85296192fbde0789a814143b6ab5d1da1
MD5 76284a425b15747bb331b562bdbebb08
BLAKE2b-256 26c57d7a52d38092c2115484a87ac7c73134751b6c28633c55ab9e3c85a43170

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page