gtfs2lc
Advanced tools
Comparing version 2.1.1 to 2.1.2
@@ -15,3 +15,3 @@ /** | ||
// Skip context if none provided | ||
if(!this._context) { | ||
if (!this._context) { | ||
this._contextStreamed = true; | ||
@@ -30,38 +30,39 @@ } | ||
this._contextStreamed = true; | ||
done(null, this._context); | ||
} else { | ||
var id = this._uris.getId(connection); | ||
const types = ['gtfs:Regular', 'gtfs:NotAvailable', 'gtfs:MustPhone', 'gtfs:MustCoordinateWithDriver']; | ||
this.push(this._context); | ||
} | ||
var lc = { | ||
"@id": id, | ||
"@type": "Connection", | ||
"departureStop": this._uris.getStopId(connection.departureStop), | ||
"arrivalStop": this._uris.getStopId(connection.arrivalStop), | ||
"departureTime": connection.departureTime, | ||
"arrivalTime": connection.arrivalTime, | ||
"gtfs:trip": this._uris.getTripId(connection), | ||
"gtfs:route": this._uris.getRouteId(connection) | ||
}; | ||
var id = this._uris.getId(connection); | ||
const types = ['gtfs:Regular', 'gtfs:NotAvailable', 'gtfs:MustPhone', 'gtfs:MustCoordinateWithDriver']; | ||
// the headsign is already the result here of earlier checking whether there’s a trip headsign | ||
// or a route headsign if connection headsign was not set. It can be used reliably | ||
if (connection.headsign) { | ||
lc["direction"] = connection.headsign; | ||
} | ||
var lc = { | ||
"@id": id, | ||
"@type": "Connection", | ||
"departureStop": this._uris.getStopId(connection.departureStop), | ||
"arrivalStop": this._uris.getStopId(connection.arrivalStop), | ||
"departureTime": connection.departureTime, | ||
"arrivalTime": connection.arrivalTime, | ||
"gtfs:trip": this._uris.getTripId(connection), | ||
"gtfs:route": this._uris.getRouteId(connection) | ||
}; | ||
var pickupType = types[0]; | ||
if (connection['pickup_type'] && connection['pickup_type'] !== null) { | ||
pickupType = types[connection['pickup_type']]; | ||
lc["gtfs:pickupType"] = pickupType; | ||
} | ||
// the headsign is already the result here of earlier checking whether there’s a trip headsign | ||
// or a route headsign if connection headsign was not set. It can be used reliably | ||
if (connection.headsign) { | ||
lc["direction"] = connection.headsign; | ||
} | ||
var dropOffType = types[0]; | ||
if (connection['drop_off_type'] && connection['drop_off_type'] !== null) { | ||
dropOffType = types[connection['drop_off_type']]; | ||
lc["gtfs:dropOffType"] = dropOffType; | ||
} | ||
var pickupType = types[0]; | ||
if (connection['pickup_type'] && connection['pickup_type'] !== null) { | ||
pickupType = types[connection['pickup_type']]; | ||
lc["gtfs:pickupType"] = pickupType; | ||
} | ||
done(null, lc); | ||
var dropOffType = types[0]; | ||
if (connection['drop_off_type'] && connection['drop_off_type'] !== null) { | ||
dropOffType = types[connection['drop_off_type']]; | ||
lc["gtfs:dropOffType"] = dropOffType; | ||
} | ||
this.push(lc); | ||
done(); | ||
} catch (err) { | ||
@@ -68,0 +69,0 @@ done(null, {}); |
{ | ||
"name": "gtfs2lc", | ||
"version": "2.1.1", | ||
"version": "2.1.2", | ||
"description": "Mapping script from gtfs to (linked) connections", | ||
@@ -5,0 +5,0 @@ "main": "lib/gtfs2lc.js", |
371845