https://github.com/fitnr/nyc-bus-gtfs
download MTA GTFS and load into an SQL database
https://github.com/fitnr/nyc-bus-gtfs
bus gtfs mta new-york-city
Last synced: 3 months ago
JSON representation
download MTA GTFS and load into an SQL database
- Host: GitHub
- URL: https://github.com/fitnr/nyc-bus-gtfs
- Owner: fitnr
- Created: 2017-03-30T14:57:39.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-11-13T18:19:07.000Z (almost 8 years ago)
- Last Synced: 2025-03-15T12:29:46.127Z (7 months ago)
- Topics: bus, gtfs, mta, new-york-city
- Language: Shell
- Homepage:
- Size: 12.7 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# NYC Bus GTFS downloader
This repo downloads NYC bus GTFS data and loads it into a MySQL database, tracking different versions of the data.
## Requirements
* MySQL
* bash command line environment
* csvkit## Install
`sudo make install`
## Usage
(If using a `~/.my.cnf` file, append `MYSQLFLAGS=` to all commands.)
```
make init DATABASE=name_of_your_database
```The `name_of_your_database` defaults to `nycbus`.
Download the current GTFS dataset. This places the files in a folder named `gtfs/YYYYMMDD`. The assumption is that you may, in the future, download a newer version of the GTFS.
```
make gtfs
```Load the downloaded GTFS into the MySQL database
```
make mysql DATABASE=name_of_your_database
```If a day goes by, or you have older GTFS data to load, use the GTFSDATE variable:
```
make mysql GTFSDATE=20170319
```## Download from transitfeed
````
# download NYCT data and Bus Company data, which often have a different date
make TRANSITFEED=YES GTFSDATE=20151223 BUSCODATE=20151227 gtfs
````The data will be put in the
## Schema
The database will contain tables for each entry file in the GTFS schema. One additional column appears on each, `feed_index`, which is an integer keyed to the `gtfs_feeds` table. The `gtfs_feeds` contains a record of the `feed_start_date`, `feed_end_date` and `feed_download_date`.