Comparing version 1.0.4 to 1.0.5
{ | ||
"stop": "http://example.org/stations/{stops.stop_id}", | ||
"route": "http://example.org/routes/{routeFrom}/{routeTo}/{routes.route_id}", | ||
"trip": "http://example.org/trips/{tripLabel}/{tripStartTime}", | ||
"connection": "http://example.org/connections/{tripLabel}/00{connection.departureStop}/{tripStartTime}/", | ||
"route": "http://example.org/routes/{routes.route_id}", | ||
"trip": "http://example.org/trips/{trips.trip_id}", | ||
"connection": "http://example.org/connections/{routes.route_id}/{trips.trip_id}/{connection.departureStop}/{tripStartTime}/", | ||
"resolve": { | ||
"routeFrom": "routes.route_long_name.replace(/\\s/gi, '').split('--')[0];", | ||
"routeTo": "routes.route_long_name.replace(/\\s/gi, '').split('--')[1];", | ||
"tripLabel": "routes.route_short_name + routes.route_id;", | ||
"tripStartTime": "format(trips.startTime, 'yyyyMMdd\\'T\\'HHmm');" | ||
} | ||
} |
@@ -24,3 +24,3 @@ #!/usr/bin/env node | ||
console.error('Please provide a path to the extracted (and sorted using gtfs2lc-sort) GTFS folder as the first argument'); | ||
process.exit(); | ||
process.exit(1); | ||
} | ||
@@ -69,6 +69,10 @@ | ||
], | ||
{ force: true }).then(function () { | ||
process.exit(0); | ||
}); | ||
{ force: true }) | ||
.then(function () { | ||
process.exit(0); | ||
}, function (err) { | ||
console.error(err); | ||
process.exit(1); | ||
}); | ||
} | ||
}); |
@@ -22,2 +22,7 @@ #!/usr/bin/env node | ||
connectionRules.on('error', err => { | ||
console.error(err.message); | ||
process.exit(-1); | ||
}) | ||
connectionRules.on('data', row => { | ||
@@ -24,0 +29,0 @@ if (connIndex === -1) { |
@@ -65,3 +65,3 @@ /** | ||
} catch (err) { | ||
console.error(err); | ||
//console.error(err); | ||
done(null, {}); | ||
@@ -68,0 +68,0 @@ } |
@@ -6,6 +6,6 @@ /** | ||
var Transform = require('stream').Transform, | ||
util = require('util'); | ||
util = require('util'); | ||
var StopTimesToConnections = function () { | ||
Transform.call(this, {objectMode : true}); | ||
Transform.call(this, { objectMode: true }); | ||
this._previousStopTime = null; | ||
@@ -21,2 +21,8 @@ }; | ||
if (this._previousStopTime && this._previousStopTime['trip_id'] === stopTime['trip_id']) { | ||
if (stopTime['arrival_time'] === '' && stopTime['departure_time'] === '') { | ||
// Both arrival and departure time for this stop are empty, so Connection rule cannot be created. | ||
// This is valid GTFS but requires interpolation to set estimated stop times. | ||
return done(new Error(`ERROR: Empty arrival and departure times found for trip ${stopTime['trip_id']} on stop ${stopTime['stop_id']}. Interpolation is required in a previous step to handle these cases.`)); | ||
} | ||
//dfm is "duration from midnight" (see GTFS reference) | ||
@@ -28,3 +34,3 @@ this.push({ | ||
departure_stop: this._previousStopTime['stop_id'], | ||
arrival_stop : stopTime['stop_id'], | ||
arrival_stop: stopTime['stop_id'], | ||
departure_stop_headsign: this._previousStopTime['stop_headsign'], | ||
@@ -31,0 +37,0 @@ arrival_stop_headsign: stopTime['stop_headsign'], |
{ | ||
"name": "gtfs2lc", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "Mapping script from gtfs to (linked) connections", | ||
@@ -33,14 +33,14 @@ "main": "lib/gtfs2lc.js", | ||
"commander": "^4.1.1", | ||
"date-fns": "^2.9.0", | ||
"date-fns": "^2.18.0", | ||
"del": "^5.1.0", | ||
"fast-csv": "^4.1.0", | ||
"fast-csv": "^4.3.6", | ||
"jsonld-stream": "^1.0.4", | ||
"keyv-file": "^0.1.13", | ||
"n3": "^1.3.5", | ||
"n3": "^1.8.1", | ||
"uri-templates": "^0.2.0" | ||
}, | ||
"devDependencies": { | ||
"coveralls": "^3.0.9", | ||
"jest": "^25.1.0" | ||
"coveralls": "^3.1.0", | ||
"jest": "^25.5.4" | ||
} | ||
} |
# GTFS to Linked Connections | ||
[![Build Status](https://travis-ci.org/linkedconnections/gtfs2lc.svg?branch=master)](https://travis-ci.org/linkedconnections/gtfs2lc) [![npm](https://img.shields.io/npm/v/gtfs2lc.svg?style=popout)](https://npmjs.com/package/gtfs2lc) [![Greenkeeper badge](https://badges.greenkeeper.io/linkedconnections/gtfs2lc.svg)](https://greenkeeper.io/) [![Coverage Status](https://coveralls.io/repos/github/linkedconnections/gtfs2lc/badge.svg?branch=master)](https://coveralls.io/github/linkedconnections/gtfs2lc?branch=master) | ||
[![Build Status](https://travis-ci.org/linkedconnections/gtfs2lc.svg?branch=master)](https://travis-ci.org/linkedconnections/gtfs2lc) [![npm](https://img.shields.io/npm/v/gtfs2lc.svg?style=popout)](https://npmjs.com/package/gtfs2lc) [![Coverage Status](https://coveralls.io/repos/github/linkedconnections/gtfs2lc/badge.svg?branch=master)](https://coveralls.io/github/linkedconnections/gtfs2lc?branch=master) | ||
@@ -5,0 +5,0 @@ Transforms a GTFS file into a directed acyclic graph of actual _connections_. |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
370023
1724
Updateddate-fns@^2.18.0
Updatedfast-csv@^4.3.6
Updatedn3@^1.8.1