@transportme/load-ptv-gtfs 1.1.3 → 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -52,7 +52,7 @@ export default class RouteLoader {
|
|
|
52
52
|
routeNumber: route.routeNumber,
|
|
53
53
|
routeGTFSID: route.routeGTFSID,
|
|
54
54
|
routePath: [],
|
|
55
|
-
operators: [ this
|
|
55
|
+
operators: [ this.getOperator(route.agencyID).name ],
|
|
56
56
|
directions: [],
|
|
57
57
|
|
|
58
58
|
codedName: sanitiseName(route.routeName)
|
|
@@ -95,6 +95,10 @@ export default class StopsLoader {
|
|
|
95
95
|
stop.codedSuburbs = stop.cleanSuburbs
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
+
updateStopLocation(stop) {
|
|
99
|
+
stop.location.coordinates = stop.bays.map(bay => bay.location.coordinates)
|
|
100
|
+
}
|
|
101
|
+
|
|
98
102
|
async mergeStops(matchingStop, stopData) {
|
|
99
103
|
let newBay = stopData.bays[0]
|
|
100
104
|
let hasIdenticalBay = matchingStop.bays.some(bay =>
|
|
@@ -107,6 +111,7 @@ export default class StopsLoader {
|
|
|
107
111
|
|
|
108
112
|
this.updateStopSuburb(matchingStop)
|
|
109
113
|
this.updateStopName(matchingStop)
|
|
114
|
+
this.updateStopLocation(matchingStop)
|
|
110
115
|
|
|
111
116
|
await this.#stops.replaceDocument({
|
|
112
117
|
_id: matchingStop._id
|
package/package.json
CHANGED
|
@@ -181,7 +181,7 @@ describe('The GTFS Routes Loader', () => {
|
|
|
181
181
|
let traralgon = await routes.findDocument({
|
|
182
182
|
routeGTFSID: '1-TRN'
|
|
183
183
|
})
|
|
184
|
-
expect(traralgon, 'Expected 1-TRN
|
|
184
|
+
expect(traralgon, 'Expected 1-TRN Traralgon to exist and not be modified').to.not.be.null
|
|
185
185
|
expect(traralgon.mode).to.equal('regional train')
|
|
186
186
|
expect(traralgon.routeNumber).to.be.null
|
|
187
187
|
expect(traralgon.routeName).to.equal('Traralgon - Melbourne Via Pakenham, Moe & Morwell')
|
|
@@ -61,6 +61,11 @@ describe('The GTFS Stops Loader', () => {
|
|
|
61
61
|
expect(wavWarrigal).to.not.be.null
|
|
62
62
|
expect(wavWarrigal.stopName).to.equal('Waverley Road/Warrigal Road')
|
|
63
63
|
expect(wavWarrigal.bays.length).to.equal(2)
|
|
64
|
+
|
|
65
|
+
expect(wavWarrigal.location.coordinates).to.deep.equal([
|
|
66
|
+
[145.091009789504, -37.879427459666],
|
|
67
|
+
[145.090653754117, -37.8795658733597]
|
|
68
|
+
])
|
|
64
69
|
})
|
|
65
70
|
|
|
66
71
|
it('Should merge non street stops, and keep the secondary stop name if they are the same', async () => {
|