gtfs-sequelize
A model of the static GTFS using sequelize.js.
Currently works only with PostgreSQL (including PostGIS) or MySQL.
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
});