Giter Site home page Giter Site logo

convert_gtfs_transit_to_sql_db's Introduction

Convert GTFS CSV files to a SQL DB

Convert a General Transit Feed Specification CSV Set to a SQL DB using Slick on Scala.

WIP

This project is a work in progress. The implementation is incomplete and subject to change. The documentation can be inaccurate.

How to use it

This version of the program converts the General Transit Feed Specification CSV Set to a SQLite database. (To convert the GTFS set to a different SQL database, just change in ./db/DbGtfs.scala both the jdbcDrvr value to another JDBC driver string, and the Database.forURL Slick call to have the connection parameters to this other SQL database.)

./GtfsCsvToDb.scala  [--ignore-agencies]  \
                      <input-directory-containing-GTFS-CSV-files>  \
                      [ <output-directory-to-contain-SQLite-db> ]

where the input and output directories contain respectively the GTFS CSV file set, and the output directory will contain a new gtfs.db file (this filename can be changed in the global ./config/Config.scala file, the gtfsDbFilename value.)

If the <output-directory-to-contain-SQLite-db> is omitted, then it is assumed by default to be the same <input-directory-containing-GTFS-CSV-files>.

The option --ignore-agencies is to ignore the validation for a unique transit agency in the GTFS routes.txt CSV file: if this GTFS file has only one transit agency, then --ignore-agencies is a no-op validation. On the other hand, if the GTFS routes.txt CSV file contains routes of multiple transit agencies, then you need to specify the --ignore-agencies in the conversion, otherwise the insertion to the SQL DB will have only those routes for the first agency appearing in the routes.txt CSV file. (Probably this option should be always implicitly assumed, and instead the explicit option should be similar to --insert-only-routes-for=transit-agency-value, and then the insertion into the DB would be only for those routes of the requested transit-agency-value. This is the first version of the program though.)

Required libraries

You should have in the CLASSPATH of your Java Virtual Machine:

. Scala Slick JAR file

. Xerial SQLite-JDBC JAR file

(other libraries required by Scala Slick, like Reactive Streams, slf4j, etc)

Note that the main program, ./GtfsCsvToDb.scala, specifies the parameters to the JVM:

   -J-Xmx4g -J-XX:NewRatio=4

respectively for the maximum JVM heap-size (for the GTFS File Set can be big), and for the New Generation Heap ratio (for the program tries to allocate all its data structures only in the New Generation to avoid costly Full Garbage Collections in the Tenured Generations): both parameters can be changed according to your case.

convert_gtfs_transit_to_sql_db's People

Contributors

je-nunez avatar

Watchers

 avatar

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.