Skip to content

Latest commit

 

History

History
65 lines (39 loc) · 2.65 KB

README.md

File metadata and controls

65 lines (39 loc) · 2.65 KB

ddot-info

A web app for accessing DDOT bus schedules and real-time data.

This site is built on Gatsby, pointed at GTFS data stored in Postgres.

You will also need a Netlify account to deploy to production: this project uses Netlify's serverless functions. If you're developing, you can use the Netlify CLI.

Key features

  • bookmarkable route and stop pages
  • time aware ui that defaults to show today's service and current trips
  • live departure, scheduled departure, and nearby transfer info for every DDOT bus stop
  • location aware component to see routes and stops within a 5 minute walk of your current location
  • digital schedule tables

Data sources

Development

Installation

yarn will install the basic project dependencies.

You'll also want to install gatsby-cli and netlify-cli.

Setting up the database

We recommend installing Postgres 12 along with the latest PostGIS extension that works with your version of Postgres.

We use gtfs-sql-importer to import GTFS files into a database.

The database structure is based on the one from gtfs-sql-importer, but we add a few helper SQL functions (defined in functions.sql) which make new fields and relationships in the GraphQL server, provided by gatsby-source-pg.

You can create a database (here, named transit) and import the project database structure from the command line.

createdb transit
psql -d transit -c 'CREATE EXTENSION postgis;'
psql -d transit < ./gtfs.sql

Next, grab the latest version of DDOT's GTFS data and import it to this database using make from the gtfs-sql-importer:

curl -o ddot_gtfs.zip "https://detroitmi.gov/Portals/0/docs/deptoftransportation/pdfs/ddot_gtfs.zip"
export PGDATABASE=transit && make load GTFS=ddot_gtfs.zip

You should see the output from SQL insert commands. Importing the DDOT GTFS file typically takes about 2-3 minutes on a newer machine.

Configuration

Create a .env.development file from the given .env.example file, filling in your database details and the DDOT_KEY API key, which can be self-provisioned at myddotbus.com.

Running the development server

You should be able to run the development server with the netlify dev command.

This will run a local Functions server that mirrors how the serverless functions operate in production.

In order to deploy this site to production, you would need a Netlify account.