Transiter was migrated from Python to Go in 2022. See the Transiter repo for the most recent version. This archived repository hosts the old Python code for posterity's sake.
Transiter is a backend web service that makes it easy to use transit data in web apps, train arrival time boards and similar technologies.
Transiter subscribes to GTFS static, GTFS realtime and other types of feeds and provides integrated views of the data through an intuitive REST API. The endpoint for a particular stop, for example, returns the stop's static data (such as its name and GPS coordinates), its realtime data (the list of vehicles that will arrive next, and the times they will arrive), as well as derived data that Transiter computes automatically, such as which routes usually call at the stop, which transfers to other stops are available, and which routes are currently calling at those stops. You can get a sense for the data that's available by navigating through the live demo site.
The easiest way to get Transiter up and running is to use Docker compose with the configuration file at docker/docker-compose.yaml. It references Docker images that are stored in Docker Hub, so it will work immediately; assuming it's in your current working directory, just run:
docker-compose up
Building the Docker images themselves is also easy. Checkout the Git repo and run:
make docker
Then launch using Docker compose:
docker-compose -f docker/docker-compose.yml up
Either approach will launch a Transiter service listening for HTTP requests on localhost's port 8000. Running
curl localhost:8000
will yield a response like:
{
"transiter": {
"version": "0.5.4",
"href": "https://github.com/jamespfennell/transiter"
"docs": {
"href": "http://localhost:8000/docs/"
}
},
"systems": {
"count": 0,
"href": "http://localhost:8000/systems"
}
}
As you can see, there are no transit systems installed and the next step is to install one. The San Francisco BART system is simple to install: assuming the steps above have been followed, simply execute:
curl -X PUT "localhost:8000/systems/sfbart?sync=true" \
-F 'config_file=https://raw.githubusercontent.com/jamespfennell/transiter-sfbart/master/Transiter-SF-BART-config.yaml'
The installation will take a couple of seconds as the BART's schedule is loaded into the database.
If you are streaming the Docker compose
output you'll notice after the installation
that realtime feed updates are now occurring every 5 seconds.
At this point you're ready to navigate the HTTP API to
access the BART's static and realtime data!
For example, to get data at the BART station
at San Francisco International Airport (stop ID SFIA
), just execute:
curl localhost:8000/systems/sfbart/stops/SFIA
- Install the New York City Subway system.
- Learn how to write transit system config files in order to add other transit systems to Transiter (it's very easy!)
- Write a custom feed parser to import data in non-standard format into Transiter.
The documentation website has much more including advice on deployment and monitoring.