ODOT-PTS / ridership-app

Ridership Data Visualization for GTFS-Ride

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ridership App

Visualize transit ridership data. Ridership App is a webapp that loads transit ridership data in GTFS-Ride format and creates web-based visualization and data exports.

It is built with next.js.

The app supports graphing, mapping, aggregating and exporting data as CSV format. Ridership data can be grouped by:

  • Route
  • Day
  • Day of Week
  • Weekday vs Sat vs Sun
  • Time of day
  • Trip
  • Stop

>

Setup

Install node.js https://nodejs.org/en/download/

Download the Ridership app code:

git clone https://github.com/ODOT-PTS/ridership-app.git

OR download https://github.com/ODOT-PTS/ridership-app/archive/refs/heads/main.zip

Install dependencies:

npm install

Configuration

Create a config.json file based off of config-example.json

cp config-example.json config.json

Add values for databases and mapboxAccessToken.

databases should be an array of objects that contain the path to a SQLite file of imported GTFS-Ride data, created using node-gtfs-ride. For example,

{
    "sqlitePath": "~/Documents/sqlite/gtfs-ride",
    "startDate": "2024-02-01",
    "endDate": "2024-02-25"
}

mapboxAccessToken should be a mapbox access token for use in generating maps. Signup and get a free Mapbox account and generate an access token.

Import Data

Import GTFS Ride data to be visualized into a sqlite database. You can use the node-gtfs-ride tool to create GTFS ride data or the [node-gtfs] tool to import existing GTFS ride data.

When importing, be sure to use the same path to the local database.

Create GTFS-Ride data with node-gtfs-ride

npm install gtfs-ride -g

gtfs-ride --gtfsPath /path/to/gtfs --apcPath /path/to/apc/data.csv

See full documentation of node-gtfs-ride.

Import existing GTFS-Ride data to SQLite with node-gtfs

npm install gtfs -g

gtfs-import --gtfsPath /path/to/your/unzipped/gtfs-ride-data

See full documentaion of node-gtfs.

Running Locally

Run the development server:

npm run dev

Open http://localhost:3000 with your browser to use the app.

Running in production

pm2 start npm --name "ridership" -- start

About

Ridership Data Visualization for GTFS-Ride

License:MIT License


Languages

Language:JavaScript 93.5%Language:TypeScript 4.1%Language:CSS 2.3%Language:Shell 0.1%