Skip to content

Using hafas-client, hafas-monitor-trips & hafas-gtfs-rt-feed as a GTFS-RT server.

License

Notifications You must be signed in to change notification settings

derhuerst/hafas-gtfs-rt-server-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hafas-gtfs-rt-server-example

Expose a HAFAS endpoint as a GTFS Realtime (GTFS-RT) server.

ISC-licensed chat with me on Gitter support me via GitHub Sponsors

This is an example project that demonstrates how to

  1. use hafas-client & hafas-monitor-trips to fetch live data about all vehicles in a bounding box,
  2. use hafas-gtfs-rt-feed & gtfs-rt-differential-to-full-dataset to build a live GTFS Realtime (GTFS-RT) feed from the data,
  3. use serve-buffer to serve the feed efficiently.

Installing & running

hafas-gtfs-rt-server-example expects a Redis server running on 127.0.0.1:6379 (default port), but you can set the REDIS_URL environment variable to change this.

Specify the bounding box to be observed as JSON:

BBOX='{"north": 52.52, "west": 13.36, "south": 52.5, "east": 13.39}'

via Docker

A Docker image is available as derhuerst/hafas-gtfs-rt-server-example.

docker run -d -p 3000:3000 -e BBOX='' derhuerst/hafas-gtfs-rt-server-example

Note: The Docker image does not contain the Redis server.

manually

git clone https://github.com/derhuerst/hafas-gtfs-rt-server-example.git
cd hafas-gtfs-rt-server-example
npm install --production

env BBOX='' node index.js

About

Using hafas-client, hafas-monitor-trips & hafas-gtfs-rt-feed as a GTFS-RT server.

Topics

Resources

License

Stars

Watchers

Forks