1 of 41

OpenTripPlanner

Past, Present and the Future

Hannes Junnila

FOSDEM 2023 — 4 February 2023

2 of 41

About me

Tinkered with OTP since ~2011

  • City of Helsinki 2014
  • Helsinki Region Transport & Digitransit 2015–2018
  • Kyyti 2020
  • Entur 2021–

hannes.junnila@gmail.com

3 of 41

4 of 41

Past — OpenTripPlanner 1

Present — OpenTripPlanner 2

  • How it works
  • New features
  • Sandbox extensions
  • Simplified setup

Future — Roadmap

Agenda

5 of 41

Past

6 of 41

7 of 41

Pain points with OTP 1

Time-dependent A* search with trip banning

  • Insufficient performance for nationwide deployments
  • Focus on research capabilities
    • Solved by split into OTP and R5
  • Lack of architectural vision and focus
  • Fragmented development
    • Each organization had its own fork

Run search

Ban trips in

found path

8 of 41

Present

9 of 41

OTP Routing Process

Flex Search

Extends the stops the user can reach by utilizing flexible transit, which has no fixed timetables/route

Transfer Optimizer

Optimizes where to transfer between each leg pair in the itineraries

Street Search

Searches for the nearest stops, where the user can board a transit vehicle

Itinerary Filtering/Decorating

Filters down the itineraries presented to the user and enriches them eg. with price

Transit Search

Searches the scheduled routes between the stops close to the origin and destination

API Routing Request

API Routing Response

10 of 41

Street Search

11 of 41

Fixed Route

09:00

09:05

09:08

09:12

09:15

09:20

09:24

09:30

12 of 41

Hail and Ride Sections

09:00

09:05

09:08

09:12

09:15

09:20

09:24

09:30

  • Fixed route and schedule

  • Between stops 3 and 6, you can board or alight anywhere along the route

13 of 41

Flexible Areas

Area A

  • Door to door anywhere within a service area

14 of 41

Flexible Areas

Area A

  • One area for boarding and another for alighting

Area B

15 of 41

Flexible Areas

Area A

Area B

Area C

  • Any number of areas, some with only boarding some with only alighting

16 of 41

Fixed Stops in an Area

Area A

  • Stop to stop within an area

17 of 41

Feeder services

Area A

  • Area to stop and vice versa

18 of 41

Complex services

Area A

Area B

19 of 41

Raptor

  • Raptor works in rounds
    • Implicit graph model using memory layout
    • One round for each transit trip & transfer
    • Exploring the transit network following transit routes.
    • Find all pareto optimal paths by
      • [ Arrival time | Number of transfers ] – Given departure time
  • Range Raptor
    • Iterates backwards over departure time within a search window
    • Only explores new trips not reached by previous rounds
    • Pareto optimal by
      • [ Departure time | Arrival time | Number of transfers ]
  • Multi-criteria Range Raptor
    • One or more additional criteria – with performance penalty
    • Pareto optimal by
      • [ Departure time | Arrival time | Number of transfers | Generalized cost ]

20 of 41

21 of 41

22 of 41

23 of 41

24 of 41

25 of 41

State

Transit Strategy

Search direction

Optimization

Result

Response time

Standard

Standard

Forward

-

Paths [ time, transfers ]

66 ms

Standard

Standard

Reverse

-

Paths [ time, transfers ]

68 ms

BestTime

Standard

Forward

-

Best time & hops, No paths

63 ms

BestTime

Standard

Reverse

-

Best time & hops, No paths

60 ms

Standard

NoWait

Forward

1 iteration

Paths [ time, transfers ]

49 ms

Standard

NoWait

Reverse

1 iteration

Paths [ time, transfers ]

48 ms

BestTime

NoWait

Forward

1 iteration

Best time & hops, No paths

41 ms

BestTime

NoWait

Reverse

1 iteration

Best time & hops, No paths

37 ms

MC

MC

Forward

-

Paths [ time, transfers, cost ]

508 ms

MC

MC

Forward

Heuristic Destination Check

Paths [ time, transfers, cost ]

320 ms

28

Samples

�Search�Window�2 - 20 h��Dataset

Norway

26 of 41

Transfer optimization

Where to transfer between a pair of trips?

  • Transfer priority cost
    • Station transfer priority*
    • Guaranteed transfers
    • In-seat transfers

  • Optimal wait time
    • Avoid very short transfer times*
    • Avoid back-travel*

* Not in raptor

27 of 41

Itinerary Filtering & Decorating

  • Limit the number of results
    • Worse but optimal results
    • Grouping too similar results
    • Park & ride, where the car is parked almost immediately

  • Decorate results
    • Real-time alerts
    • Price calculation

  • Sorting of results

28 of 41

NeTEx–GTFS

  • New internal data model independent of the import format
    • OTP 1 used GTFS POJOs internally
  • New entities from NeTEX not existing in GTFS

Different formats have different benefits

  • GTFS
    • Easy to produce and consume
    • YAGNI — Requires producer and consumer before appending spec
  • Netex
    • Much more complex and nuanced
    • Caters for almost all use cases

29 of 41

Sandbox extensions

  • New feature in OTP 2 for code not suited for core
  • Extremely successful, currently 22 extensions
    • New APIs
      • GraphQL
      • Travel time
      • Vector tiles
    • New data formats
      • Data overlay
      • SIRI
    • New functionality under development
      • GTFS-Fares v2
      • GTFS-Flex v2
    • Deployment-specific code
      • Non-GBFS vehicle rental updaters
      • Cloud integrations

30 of 41

GraphQL APIs

Two APIs with different vocabularies

  • GTFS
  • Transmodel

31 of 41

Vector tiles

  • Mapbox vector tile format
  • Multiple layer types available
    • Stops & stations
    • Rental stations & vehicles
    • Car and bike parking
  • Configurable mapping from internal model to tile layer
    • Real-time info
    • Multilingual

32 of 41

Travel time analysis

  • Requested feature from OTP 1
  • Two output formats
    • GeoJSON — isochrones
    • GeoTIFF — travel time rasters
  • Configurable street & transit modes

33 of 41

Simplified operations

  • Abstracted data sources
    • Local file system
    • HTTPS
    • Cloud storage services
      • GCP storage
      • Azure blob storage
      • AWS S3 (open PR pending somebody using it)
  • All input and output paths can be configured
    • Data can be read from or written to an data source
  • Improved monitoring support
    • Prometheus endpoint

34 of 41

https://docs.opentripplanner.org/en/dev-2.x/BuildConfiguration/

35 of 41

//build-config.json

{

"transitModelTimeZone": "Europe/Brussels",

"osmCacheDataInMem": "true",

"osm": [

{

"source": "https://download.geofabrik.de/europe/belgium-latest.osm.pbf",

"osmTagMapping": "germany"

}

],

"transitFeeds": [

{

"type": "gtfs",

"feedId": "NMBS",

"source": "http://gtfs.irail.be/nmbs/gtfs/latest.zip"

},

{

"type": "gtfs",

"feedId": "LIJN",

"source": "http://gtfs.irail.be/de-lijn/de_lijn-gtfs.zip"

},

{

"type": "gtfs",

"feedId": "TEC",

"source": "https://gtfs.irail.be/tec/tec-gtfs.zip"

},

{

"type": "gtfs",

"feedId": "MIVB",

"source": "https://gtfs.irail.be/mivb/mivb-gtfs.zip"

},

]

}

36 of 41

Future

37 of 41

Performance

38 of 41

Competition neutrality

  • New Raptor criteria
  • Fixed size bitset for used authority/operator group

  • Operator 1, departure from A at 18:00, arrival at B at 21:00
  • Operator 2, departure from A at 18:01, arrival at B at 20:59
  • => Only operator 2 is showing up

39 of 41

Unified GraphQL API

  • Currently two GraphQL APIs and one REST API
    • Deprecate REST API
  • New unified GraphQL API
    • One structure
    • Two dialects, GTFS and Transmodel
    • Use translation file go from internal model to API

40 of 41

41 of 41

Useful links