@transportme/load-ptv-gtfs 1.0.2 → 1.0.4

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.
package/index.mjs CHANGED
@@ -12,6 +12,9 @@ import { GTFSStop, GTFSPlatformStop } from './lib/gtfs-parser/GTFSStop.mjs'
12
12
  import { GTFSStopTime } from './lib/gtfs-parser/GTFSStopTime.mjs'
13
13
  import GTFSTrip from './lib/gtfs-parser/GTFSTrip.mjs'
14
14
 
15
+ import setRouteStops from './lib/post-processing/set-route-stops.mjs'
16
+ import setStopServices from './lib/post-processing/set-stop-services.mjs'
17
+
15
18
  const GTFSTypes = {
16
19
  GTFSAgency, GTFSCalendar, GTFSCalendarDate,
17
20
  GTFSRoute, GTFSShape, GTFSShapePoint,
@@ -22,5 +25,6 @@ const GTFSTypes = {
22
25
  export {
23
26
  RouteLoader, ShapeLoader,
24
27
  StopsLoader, TripLoader,
25
- GTFSTypes
28
+ GTFSTypes,
29
+ setRouteStops, setStopServices
26
30
  }
@@ -1,4 +1,4 @@
1
- import { booleanPointInPolygon, intersect } from '@turf/turf'
1
+ import booleanPointInPolygon from '@turf/boolean-point-in-polygon'
2
2
  import { STOP_UTILS } from '@transportme/transportvic-utils'
3
3
 
4
4
  const { processName, getPrimaryStopName, getSecondaryStopName } = STOP_UTILS
@@ -1,6 +1,12 @@
1
- import async, { dir } from 'async'
1
+ import async from 'async'
2
2
  import merge from './merge-stops.mjs'
3
+ import DatabaseConnection from '@transportme/database/lib/DatabaseConnection.mjs'
3
4
 
5
+ /**
6
+ * Loads route stop data into the database. This is generated based off the timetable data.
7
+ *
8
+ * @param {DatabaseConnection} database The database connection to use
9
+ */
4
10
  export default async function setRouteStops(database) {
5
11
  let gtfsTimetables = database.getCollection('gtfs timetables')
6
12
  let routes = database.getCollection('routes')
@@ -1,3 +1,4 @@
1
+ import DatabaseConnection from '@transportme/database/lib/DatabaseConnection.mjs'
1
2
  import async from 'async'
2
3
 
3
4
  const AGGREGATION_GROUP = {
@@ -14,6 +15,12 @@ function compareService(a, b) {
14
15
  return a.routeGTFSID.localeCompare(b.routeGTFSID) || a.gtfsDirection - b.gtfsDirection
15
16
  }
16
17
 
18
+ /**
19
+ * Loads service data onto all stops in the database.
20
+ *
21
+ * @param {DatabaseConnection} database The database connection to use
22
+ * @param {function} [onMilestone] A function triggered for every 500 stops processed
23
+ */
17
24
  export default async function setStopServices(database, onMilestone = () => {}) {
18
25
  let gtfsTimetables = database.getCollection('gtfs timetables')
19
26
  let stops = database.getCollection('stops')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transportme/load-ptv-gtfs",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "",
5
5
  "main": "index.mjs",
6
6
  "scripts": {
@@ -11,7 +11,7 @@
11
11
  "dependencies": {
12
12
  "@transportme/database": "^1.0.2",
13
13
  "@transportme/transportvic-utils": "^1.0.0",
14
- "@turf/turf": "^7.0.0",
14
+ "@turf/boolean-point-in-polygon": "^7.1.0",
15
15
  "adm-zip": "^0.5.14",
16
16
  "async": "^3.2.6",
17
17
  "line-reader": "^0.4.0",