Giter VIP home page Giter VIP logo

gtfs-schema's Introduction

PostgreSQL GTFS Schema

PostgreSQL schema for GTFS feeds from across the world.

The best resource for up-to-date GTFS feeds is TransitFeeds.

Nothing Overwhelming Here

The differences between the various agencies schema.sql files is based on the different optional fields and file in an agency's feed. The columns in a table should match with the header row of a GTFS file.

There is also a pre-processing script which builds a schema.sql file for a given GTFS feed based on the presence of optional fields and files.

Usage

Use the following template command to load a GTFS feed into a Postgres database:

psql --host=<db_host> --port=<port> --username=<db_username> --dbname=<dbname> --file=schema.sql --password

You will be prompted to enter the password for the provided db user and then the schema.sql script will begin executing on the host. Depending on the size of the stop_times.txt file (some are a few million rows), the process may take up to 30 minutes.

The output should look like:

DROP TABLE
DROP TABLE
DROP TABLE
DROP TABLE
DROP TABLE
DROP TABLE
DROP TABLE
CREATE TABLE
CREATE TABLE
CREATE TABLE
CREATE TABLE
CREATE TABLE
CREATE TABLE
CREATE TABLE

Generating a schema

You can also generate a schema based on an existing GTFS file. The script requires Bash version 4.0 or newer to run. Unzip the GTFS zip file into a working directory. Then run:

./gtfs_schema.sh gtfs-directory > schema.sql

Then run the psql command above. You could also combine both commands into one:

./gtfs-schema.sh gtfs-directory | psql --host=<db_host> --port=<port> --username=<db_username> --dbname=<dbname> --password

Contribute

Feel free to submit a PR to contribute a new schema.

GTFS Schema Visualized

Image from chroman's original df-gtfs repo.

Image

gtfs-schema's People

Contributors

christianroman avatar hfs avatar tyleragreen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gtfs-schema's Issues

No license information found in this repository

Hi @tyleragreen ,
Thank you so much for providing this repository. I'll use it now to build databases from GTFS from public transport agencies. I have not found any license information in this repository. Do you mind adding a license? Personally, open source can not be ranked highest. If you ask me, I suggest licenses like GNU GPL or GNU FDL. This is a good list of open source licenses with comparison.

Cheers!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.