@transportme/load-ptv-gtfs 1.4.9 → 1.4.10
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.
|
@@ -23,15 +23,18 @@ export default class RouteLoader {
|
|
|
23
23
|
* @param {string} agencyFile The path for the agency.txt file
|
|
24
24
|
* @param {string} mode The route's mode
|
|
25
25
|
* @param {DatabaseConnection} database A database connection
|
|
26
|
-
* @param {string} collectionName The collection to store the routes in. Defaults to gtfs-routes
|
|
27
26
|
*/
|
|
28
|
-
constructor(routesFile, agencyFile, mode, database
|
|
29
|
-
this.#routes =
|
|
27
|
+
constructor(routesFile, agencyFile, mode, database) {
|
|
28
|
+
this.#routes = this.getRoutesDB(database)
|
|
30
29
|
this.#mode = mode
|
|
31
30
|
this.#routesReader = this.createRouteReader(routesFile, mode)
|
|
32
31
|
this.#agencyFile = agencyFile
|
|
33
32
|
}
|
|
34
33
|
|
|
34
|
+
getRoutesDB(db) {
|
|
35
|
+
return db.getCollection('gtfs-routes')
|
|
36
|
+
}
|
|
37
|
+
|
|
35
38
|
createRouteReader(routesFile, mode) {
|
|
36
39
|
return new GTFSRouteReader(routesFile, mode)
|
|
37
40
|
}
|
|
@@ -13,13 +13,16 @@ export default class ShapeLoader {
|
|
|
13
13
|
*
|
|
14
14
|
* @param {string} shapeFile The path for the shapes.txt file
|
|
15
15
|
* @param {DatabaseConnection} database A database connection
|
|
16
|
-
* @param {string} collectionName The collection to store the routes in. Defaults to gtfs-routes
|
|
17
16
|
*/
|
|
18
|
-
constructor(shapeFile, database
|
|
19
|
-
this.#routes =
|
|
17
|
+
constructor(shapeFile, database) {
|
|
18
|
+
this.#routes = this.getRoutesDB(database)
|
|
20
19
|
this.#shapeReader = this.createShapeReader(shapeFile)
|
|
21
20
|
}
|
|
22
21
|
|
|
22
|
+
getRoutesDB(db) {
|
|
23
|
+
return db.getCollection('gtfs-routes')
|
|
24
|
+
}
|
|
25
|
+
|
|
23
26
|
createShapeReader(shapeFile) {
|
|
24
27
|
return new GTFSShapeReader(shapeFile)
|
|
25
28
|
}
|
|
@@ -20,15 +20,18 @@ export default class StopsLoader {
|
|
|
20
20
|
* @param {string} mode The transit mode being loaded
|
|
21
21
|
* @param {DatabaseConnection} database A database connection
|
|
22
22
|
* @param {function} [suburbHook] A hook that returns the stop's suburb, or null if unavailable. This function is called before processing from the stop's name or location
|
|
23
|
-
* @param {string} collectionName The collection to store the stops in. Defaults to gtfs-stops
|
|
24
23
|
*
|
|
25
24
|
*/
|
|
26
|
-
constructor(stopsFile, suburbs, mode, database, suburbHook
|
|
27
|
-
this.#stops =
|
|
25
|
+
constructor(stopsFile, suburbs, mode, database, suburbHook) {
|
|
26
|
+
this.#stops = this.getStopsDB(database)
|
|
28
27
|
this.#mode = mode
|
|
29
28
|
this.#stopsReader = this.createStopReader(stopsFile, suburbs, suburbHook)
|
|
30
29
|
}
|
|
31
30
|
|
|
31
|
+
getStopsDB(db) {
|
|
32
|
+
return db.getCollection('gtfs-stops')
|
|
33
|
+
}
|
|
34
|
+
|
|
32
35
|
createStopReader(stopsFile, suburbs, suburbHook) {
|
|
33
36
|
return new GTFSStopsReader(stopsFile, suburbs, suburbHook)
|
|
34
37
|
}
|
|
@@ -42,19 +42,11 @@ export default class TripLoader {
|
|
|
42
42
|
* @param {string} paths.calendarDatesFile The path for the calendar_dates.txt file
|
|
43
43
|
* @param {string} mode The transit mode being loaded
|
|
44
44
|
* @param {DatabaseConnection} database A database connection
|
|
45
|
-
* @param {Object} colls Used to specify the collection names to write into
|
|
46
|
-
* @param {string} colls.routeColl The collection to store the routes in. Defaults to gtfs-routes
|
|
47
|
-
* @param {string} colls.stopColl The collection to store the stops in. Defaults to gtfs-stops
|
|
48
|
-
* @param {string} colls.timetableColl The collection to store the timetables in. Defaults to gtfs-gtfs timetables
|
|
49
45
|
*/
|
|
50
|
-
constructor({ tripsFile, stopTimesFile, calendarFile, calendarDatesFile }, mode, database
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
} = {}) {
|
|
55
|
-
this.#routes = database.getCollection(routeColl)
|
|
56
|
-
this.#stops = database.getCollection(stopColl)
|
|
57
|
-
this.#trips = database.getCollection(timetableColl)
|
|
46
|
+
constructor({ tripsFile, stopTimesFile, calendarFile, calendarDatesFile }, mode, database) {
|
|
47
|
+
this.#routes = this.getRoutesDB(database)
|
|
48
|
+
this.#stops = this.getStopsDB(database)
|
|
49
|
+
this.#trips = this.getTripsDB(database)
|
|
58
50
|
|
|
59
51
|
this.#mode = mode
|
|
60
52
|
|
|
@@ -63,6 +55,18 @@ export default class TripLoader {
|
|
|
63
55
|
this.#calendarReader = this.createCalendarReader(calendarFile, calendarDatesFile)
|
|
64
56
|
}
|
|
65
57
|
|
|
58
|
+
getRoutesDB(db) {
|
|
59
|
+
return db.getCollection('gtfs-routes')
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
getStopsDB(db) {
|
|
63
|
+
return db.getCollection('gtfs-stops')
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
getTripsDB(db) {
|
|
67
|
+
return db.getCollection('gtfs-gtfs timetables')
|
|
68
|
+
}
|
|
69
|
+
|
|
66
70
|
createStopTimesReader(stopTimesFile, mode) {
|
|
67
71
|
return new GTFSStopTimesReader(stopTimesFile, mode)
|
|
68
72
|
}
|