Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gtfs-sequelize

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gtfs-sequelize

A model for the static GTFS using sequelize.

  • 2.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6
Maintainers
1
Weekly downloads
 
Created
Source

gtfs-sequelize

npm version Build Status Dependency Status Test Coverage

A model of the static GTFS using sequelize.js.

Currently works only with PostgreSQL (including PostGIS), MySQL (with spatial capabilities) and sqlite (but NOT spatialite).

Table of Contents

Installation

In order to use this library, you must also install the additional libraries in your project depending on the database that you use.

PostgreSQL

npm install pg --save
npm install pg-copy-streams --save
npm install pg-hstore --save
With pg and node v0.10.x

You must also install the package promise-polyfill and write additional code. See here for more details.

MySQL

npm install mysql --save
npm install streamsql --save

SQLite

npm install sqlite3 --save
npm install streamsql --save

Usage with SQLite requires that sqlite is installed and is available via a unix command line.

Usage:

Downloading the GTFS File:

  var GTFS = require('gtfs-sequelize');

  var downloadConfig = {
    gtfsUrl: 'http://feed.rvtd.org/googleFeeds/static/google_transit.zip',
    downloadsDir: 'downloads'
  };

  var gtfs = GTFS(downloadConfig);
  gtfs.downloadGtfs(function() {
    //download has finished callback
  });

Loading GTFS into Database:

  var GTFS = require('gtfs-sequelize');

  var pgConfig = {
    database: 'postgres://gtfs_sequelize:gtfs_sequelize@localhost:5432/gtfs-sequelize-test',
    downloadsDir: 'downloads',
    gtfsFilename: 'google_transit.zip',
    sequelizeOptions: {
      logging: false
    }
  }

  var gtfs = GTFS(pgConfig);
  gtfs.loadGtfs(function() {
    //database loading has finished callback
  });

Loading into a DB with PostGIS installed:

  var GTFS = require('gtfs-sequelize');

  var pgConfig = {
    database: 'postgres://gtfs_sequelize:gtfs_sequelize@localhost:5432/gtfs-sequelize-test',
    downloadsDir: 'downloads',
    gtfsFilename: 'google_transit.zip',
    spatial: true,
    sequelizeOptions: {
      logging: false
    }
  }

  var gtfs = GTFS(pgConfig);
  gtfs.loadGtfs(function() {
    //database loading has finished callback
  });

Querying a specific schema within a DB:

var GTFS = require('gtfs-sequelize');

var pgConfig = {
  database: 'postgres://gtfs_sequelize:gtfs_sequelize@localhost:5432/gtfs-sequelize-test',
  downloadsDir: 'downloads',
  gtfsFilename: 'google_transit.zip',
  spatial: true,
  sequelizeOptions: {
    logging: false,
    schema: 'test_schema'
  }
}

var gtfs = GTFS(pgConfig);
gtfs.loadGtfs(function() {
  //database loading has finished callback
});

Keywords

FAQs

Package last updated on 21 Jan 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc