@transportme/load-ptv-gtfs 1.4.33 → 1.4.34
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.
|
@@ -13,9 +13,11 @@ export default class RouteLoader {
|
|
|
13
13
|
#routesReader
|
|
14
14
|
#operators = {}
|
|
15
15
|
#agencyFile
|
|
16
|
+
#routesFile
|
|
16
17
|
|
|
17
18
|
#routeIDMap = {}
|
|
18
19
|
|
|
20
|
+
|
|
19
21
|
/**
|
|
20
22
|
* Creates a new Shape Loader.
|
|
21
23
|
*
|
|
@@ -27,8 +29,8 @@ export default class RouteLoader {
|
|
|
27
29
|
constructor(routesFile, agencyFile, mode, database) {
|
|
28
30
|
this.#routes = this.getRoutesDB(database)
|
|
29
31
|
this.#mode = mode
|
|
30
|
-
this.#
|
|
31
|
-
this.#agencyFile = agencyFile
|
|
32
|
+
this.#routesFile = routesFile
|
|
33
|
+
this.#agencyFile = agencyFile
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
getRoutesDB(db) {
|
|
@@ -111,6 +113,8 @@ export default class RouteLoader {
|
|
|
111
113
|
async loadRoutes({ processRoute } = {}) {
|
|
112
114
|
await this.loadAgencies()
|
|
113
115
|
|
|
116
|
+
this.#routesReader = this.createRouteReader(this.#routesFile, this.#mode)
|
|
117
|
+
|
|
114
118
|
await this.#routesReader.open()
|
|
115
119
|
while (this.#routesReader.available()) {
|
|
116
120
|
try {
|
|
@@ -6,6 +6,8 @@ export default class ShapeLoader {
|
|
|
6
6
|
#routes
|
|
7
7
|
#shapeReader
|
|
8
8
|
|
|
9
|
+
#shapeFile
|
|
10
|
+
|
|
9
11
|
#routeCache = {}
|
|
10
12
|
|
|
11
13
|
/**
|
|
@@ -16,7 +18,7 @@ export default class ShapeLoader {
|
|
|
16
18
|
*/
|
|
17
19
|
constructor(shapeFile, database) {
|
|
18
20
|
this.#routes = this.getRoutesDB(database)
|
|
19
|
-
this.#
|
|
21
|
+
this.#shapeFile = shapeFile
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
getRoutesDB(db) {
|
|
@@ -83,6 +85,8 @@ export default class ShapeLoader {
|
|
|
83
85
|
* @param {function} options.shapeIDMap A mapping of shape IDs to their trip IDs.
|
|
84
86
|
*/
|
|
85
87
|
async loadShapes({ shapeIDMap }) {
|
|
88
|
+
this.#shapeReader = this.createShapeReader(this.#shapeFile)
|
|
89
|
+
|
|
86
90
|
await this.#shapeReader.open()
|
|
87
91
|
|
|
88
92
|
let shapesLoaded = 0
|
|
@@ -10,6 +10,10 @@ export default class StopsLoader {
|
|
|
10
10
|
#mode
|
|
11
11
|
#stopsReader
|
|
12
12
|
|
|
13
|
+
#stopsFile
|
|
14
|
+
#suburbs
|
|
15
|
+
#suburbHook
|
|
16
|
+
|
|
13
17
|
#parentHolding = {}
|
|
14
18
|
|
|
15
19
|
/**
|
|
@@ -25,7 +29,9 @@ export default class StopsLoader {
|
|
|
25
29
|
constructor(stopsFile, suburbs, mode, database, suburbHook) {
|
|
26
30
|
this.#stops = this.getStopsDB(database)
|
|
27
31
|
this.#mode = mode
|
|
28
|
-
this.#
|
|
32
|
+
this.#stopsFile = stopsFile
|
|
33
|
+
this.#suburbs = suburbs
|
|
34
|
+
this.#suburbHook = suburbHook
|
|
29
35
|
}
|
|
30
36
|
|
|
31
37
|
getStopsDB(db) {
|
|
@@ -195,6 +201,7 @@ export default class StopsLoader {
|
|
|
195
201
|
* @param {function} options.getMergeName Used to get a stop's merge name. Return null to use the default merge name.
|
|
196
202
|
*/
|
|
197
203
|
async loadStops(options) {
|
|
204
|
+
this.#stopsReader = this.createStopReader(this.#stopsFile, this.#suburbs, this.#suburbHook)
|
|
198
205
|
await this.#stopsReader.open()
|
|
199
206
|
while (this.#stopsReader.available()) {
|
|
200
207
|
try {
|
|
@@ -32,6 +32,11 @@ export default class TripLoader {
|
|
|
32
32
|
|
|
33
33
|
#tripsToLoad = []
|
|
34
34
|
|
|
35
|
+
#tripsFile
|
|
36
|
+
#stopTimesFile
|
|
37
|
+
#calendarFile
|
|
38
|
+
#calendarDatesFile
|
|
39
|
+
|
|
35
40
|
/**
|
|
36
41
|
* Creates a new Trip Loader.
|
|
37
42
|
*
|
|
@@ -50,9 +55,10 @@ export default class TripLoader {
|
|
|
50
55
|
|
|
51
56
|
this.#mode = mode
|
|
52
57
|
|
|
53
|
-
this.#
|
|
54
|
-
this.#
|
|
55
|
-
this.#
|
|
58
|
+
this.#tripsFile = tripsFile
|
|
59
|
+
this.#stopTimesFile = stopTimesFile
|
|
60
|
+
this.#calendarFile = calendarFile
|
|
61
|
+
this.#calendarDatesFile = calendarDatesFile
|
|
56
62
|
}
|
|
57
63
|
|
|
58
64
|
getRoutesDB(db) {
|
|
@@ -236,6 +242,10 @@ export default class TripLoader {
|
|
|
236
242
|
async loadTrips({ routeIDMap, processTrip, onWrite = () => {} }) {
|
|
237
243
|
this.#routeIDMap = routeIDMap
|
|
238
244
|
|
|
245
|
+
this.#stopTimesReader = this.createStopTimesReader(this.#stopTimesFile, this.#mode)
|
|
246
|
+
this.#tripsReader = this.createTripReader(this.#tripsFile, null, null, this.#mode)
|
|
247
|
+
this.#calendarReader = this.createCalendarReader(this.#calendarFile, this.#calendarDatesFile)
|
|
248
|
+
|
|
239
249
|
await this.loadCalendarData()
|
|
240
250
|
await this.loadTripsData()
|
|
241
251
|
|