get live trimet vehicle data into a dat or regular fs file
- data parsed to ndjson values (optionally as geojson)
npm install trimet-live-archive
See example.js
for full example.
- Sign up for trimet API & Get
appID
. - Create a hyperdrive archive to write to
var trimetDat = require('trimet-live-archive')
var archive = hyperdrive('./data')
var appID = 'YOUR_APP_ID'
var trimet = trimetDat(archive, {appID: appID})
trimet.fetch(function (err) {
if (err) throw err
console.log('done')
})
You can write to a regular fs file too!
var trimetDat = require('trimet-live-archive')
var appID = 'YOUR_APP_ID'
var trimet = trimetDat({appID: appID, dataFile: 'data.json'})
trimet.fetch(function (err) {
if (err) throw err
console.log('done')
})
-
archive
: hyperdrive archive or fs -
opts.appID
: required trimet app id -
opts.geojson
: write data as geojson -
opts.dataFile
: path to write json data to
Fetch live vehicle data! Writes to archive files.
Use DEBUG=trimet-live-archive
when running the process.