Playground.

KTMB Tracker

Cover Image for KTMB Tracker
by Fikri

Introduction

For this project, I have built a real-time train tracking application for KTMB (Keretapi Tanah Melayu Berhad) to visualize live train positions on an interactive map. The application leverages GTFS (General Transit Feed Specification) Realtime data and Protocol Buffers.

What I have done & learnt

The application fetches vehicle position data from API, which is encoded as Protocol Buffers.A protobuf decoder then loads the GTFS Realtime schema and decodes binary data. Static data also been used to enrich the data point before plotted on an interactive map.

Project stack/ packages

  • React with TypeScript
  • Vite
  • Tailwind
  • Leaflet
  • protobufjs
  • PapaParse

Improvements

  1. Add train status indicators (on-time, delayed, cancelled) based on schedule adherence.
  2. Github actions to rebuild the app automatically when the static data is fetched daily.

Resources

  1. GTFS Realtime API Documentation
  2. GTFS Static API Documentation
  3. Frontend repo