Site Tools


projects:software:malaysia_gtfs_opentripplanner_onebusaway

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
projects:software:malaysia_gtfs_opentripplanner_onebusaway [2024/12/31 20:47] – add link to demo! Andrew Yongprojects:software:malaysia_gtfs_opentripplanner_onebusaway [2025/01/01 07:25] (current) – placeholder for OneBusAway connection Andrew Yong
Line 1: Line 1:
 ====== Connecting Malaysia's Transport Data APIs to OpenTripPlanner and OneBusAway ====== ====== Connecting Malaysia's Transport Data APIs to OpenTripPlanner and OneBusAway ======
  
-FIXME This page is a work in progress.+===== Problem Statement =====
  
-Instructions are written with [[https://docs.docker.com/compose/install/|Docker Compose]] in mindbut it'possible (with many more steps) to [[https://docs.opentripplanner.org/en/latest/Basic-Tutorial/|run OpenTripPlanner standalone]] with the configuration below.+I recently moved to Kuala Lumpur, Malaysia and rely on public transportation as part of my daily commute. 
 + 
 +==== Wayfinding ==== 
 + 
 +The Klang Valley has an extensive public transportation network. However, its planning is constrained physically and financially by the valley's existing road network sprawl, undulating topography and [[https://civil.utm.my/wp-content/uploads/2016/12/Land-Acquisition-for-Klang-Valley-Mass-Rapid-Transit-Line-1-Project.pdf|tedious land acquisition]], resulting in a large number of [[https://myrapid.com.my/bus-train/rapid-kl/rapid-kl-integrated-transit-map/|interchanges between rail lines]] and transit modes that are not immediately obvious. Often, the best route or easiest transfer is not always at a designated interchange or hub). Thus, **wayfinding** is a problem I face. 
 + 
 +==== Realtime Information ==== 
 + 
 +The Klang Valley has [[https://www.planningmalaysia.org/index.php/pmj/article/download/Article%201-8/36|extensive suburban sprawl]], so the last-mile journey relies on the  [[https://myrapid.com.my/bus-train/rapid-kl/bus/|bus network]] (other than car ownership - park and ride). Howeverthat sprawl, coupled with Klang Valley'notorious traffic congestion, makes it expensive and challenging (from my experience as a public bus captain, I would say, impossible) to maintain a consistent and short service interval on the bus network. 
 + 
 +Short of public transportation reform, I want to make best use of the level of service that is already there. 
 + 
 +For example, the loop service (service 650) that serves my taman (estate, literally "park") runs at a planned frequency of between 20 to 40 minutes, but due to congestion along Jalan Klang Lama (compounded by inclement weather), can have headways degraded to 40 to 60 minutes. 
 + 
 +With such long headways, the wait for the bus becomes half of, or more, of the commute time; rather than giving up on public transportation, having **realtime information** (specifically, realtime bus arrival times) means I can make more efficient use of my time by running errands or having a meal while waiting for the bus. 
 + 
 +===== Existing Solutions ===== 
 + 
 +=== Maps === 
 + 
 +  * [[https://myrapid.com.my/bus-train/rapid-kl/rapid-kl-integrated-transit-map/|RapidKL Integrated Transit Map]] 
 + 
 +=== Directions (Wayfinding), Schedules and Arrival Times === 
 + 
 +  * [[https://www.google.com.my/maps|Google Maps]] 
 +    * Good: 
 +      * Wayfinding (directions) 
 +    * Bad: 
 +        * Live arrival times are not accurate 
 +        * Scheduled departure times are not accurate or missing entirely 
 +  * [[https://moovitapp.com/|Moovit]] ([[https://apps.apple.com/us/app/moovit-public-transit/id498477945|App Store]]/[[https://play.google.com/store/apps/details?id=com.tranzmate|Play Store]]) 
 +    * Good: 
 +      * Live arrival times are accurate (±1-3 min) 
 +      * Scheduled departure times 
 +    * Bad: 
 +      * Constant and annoying full-screen advertisements (or monthly subscription) 
 +      * Live bus location is behind monthly subscription paywall 
 +  * [[https://myrapid.com.my/pulse/|MyRapid PULSE]] ([[https://apps.apple.com/my/app/myrapid-pulse/id6736607730|App Store]]/[[https://play.google.com/store/apps/details?id=com.prasarana.pulse.v4|Play Store]]) 
 +    * Good: 
 +       * Live arrival times are accurate (±1-3 min) 
 +       * Scheduled departure times 
 +    * Bad: 
 +      * Wayfinding (directions) 
 +===== ... And a Few New Problems ===== 
 + 
 +==== No Swiss Army Knife ==== 
 + 
 +There is no //Swiss Army knife// app that does everything (wayfinding + schedules + arrival times) well without having some kind of catch. 
 + 
 +**A new problem arises that multiple apps/information/facilities above need to be used to find the best route.** 
 + 
 +==== Closed Source + Ads ==== 
 + 
 +Closed Source is probably a weak criticism to make, as are ads, since the GTFS datasets are huge and processing them is computationally (and thus financially) expensive. I think these solutions should exist for the general public who are willing to tolerate advertisements or pay to have an ad-free experience, at least, until a better option arises. After all, developers need to eat and earn a living wage, too. 
 + 
 +But it is a problem to me because: 
 + 
 +  * Closed source means we cannot learn how the data is consumed, computed and presented, and philosophically I believe in freedom of knowledge rather than be fully dependent on black boxes built by corporations 
 +  * If I dislike ads and am willing to bear the cost of running my own infrastructure, then I want an ad-free self-hosted experience 
 + 
 +Furthermore, knowing how my solution works and bearing the cost of hosting it, I am incentivized to make it cost-effective rather than being incentivized to burden the user with ads or a subscription instead. 
 + 
 +===== Building a Solution ===== 
 + 
 +Given the lack of a comprehensive solution, and fully at risk of [[https://xkcd.com/927/|creating yet another competing and imperfect solution]], I decided to explore building a solution. 
 + 
 +Even if I do not succeed (or get distracted by other commitments), at least the documentation below will serve as a starting point for anyone who finds themselves experiencing the same problems I did. 
 + 
 +:!: This is a **living document** and the documentation below will continue to evolve as I try/build/fix things :!:
  
-**Demo: https://otp.ndoo.my/** 
 ===== Malaysia's Transport Data APIs ===== ===== Malaysia's Transport Data APIs =====
 +
 +Building a solution starts strong, because the [[https://data.gov.my/|Government of Malaysia Open Data Portal]] provides two authoritative public transportation data APIs in standard [[https://gtfs.org/|GTFS]] formats.
  
   * [[https://developer.data.gov.my/realtime-api/gtfs-static|GTFS Static API]] - consumed to build OpenTripPlanner Graph   * [[https://developer.data.gov.my/realtime-api/gtfs-static|GTFS Static API]] - consumed to build OpenTripPlanner Graph
   * [[https://developer.data.gov.my/realtime-api/gtfs-realtime|GTFS Realtime API]] - consumed by OpenTripPlanner Realtime Updaters   * [[https://developer.data.gov.my/realtime-api/gtfs-realtime|GTFS Realtime API]] - consumed by OpenTripPlanner Realtime Updaters
- 
  
 ===== OpenTripPlanner ===== ===== OpenTripPlanner =====
 +
 +> OpenTripPlanner (OTP) is an open source multi-modal trip planner, focusing on travel by scheduled public transportation in combination with bicycling, walking, and mobility services including bike share and ride hailing.
 +
 +Instructions are written with [[https://docs.docker.com/compose/install/|Docker Compose]] in mind, but it's possible (with many more steps) to [[https://docs.opentripplanner.org/en/latest/Basic-Tutorial/|run OpenTripPlanner standalone]] with the configuration below.
 +
 +**Demo: https://otp.ndoo.my/**
  
 ==== Preparation - Files ==== ==== Preparation - Files ====
Line 134: Line 208:
     * Docker (foreground): ''%%docker run -it --rm -p 8080:8080 -v ./opentripplanner:/var/opentripplanner docker.io/opentripplanner/opentripplanner:latest --load --serve%%''     * Docker (foreground): ''%%docker run -it --rm -p 8080:8080 -v ./opentripplanner:/var/opentripplanner docker.io/opentripplanner/opentripplanner:latest --load --serve%%''
  
-FIXME FIXME FIXME FIXME FIXME INCOMPLETE+FIXME unfinished writing, a conclusion and some screenshots here would be nice 
 + 
 +===== Connecting to OneBusAway ===== 
 + 
 +We will use OneBusAway as a mobile app frontend to OneTripPlanner. 
 + 
 +FIXME unfinished writing, OneBusAway + OpenTripPlanner works on Android, but not iOS; there was [[https://github.com/OneBusAway/otpkit|a GSoC 2024 project to support OpenTripPlanner on OneBusAway iOS]] but the app implementation never happened.
projects/software/malaysia_gtfs_opentripplanner_onebusaway.1735678067.txt.gz · Last modified: 2024/12/31 20:47 by Andrew Yong