gtfs 4.3.0 → 4.3.2
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/CHANGELOG.md +17 -0
- package/lib/gtfs/shapes.js +7 -5
- package/lib/gtfs/stops.js +6 -3
- package/lib/import.js +3 -1
- package/package.json +7 -7
- package/test/mocha/export-gtfs.js +4 -2
- package/test/mocha/import-gtfs.js +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,23 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [4.3.2] - 2023-06-14
|
|
9
|
+
|
|
10
|
+
### Updated
|
|
11
|
+
|
|
12
|
+
- Dependency updates
|
|
13
|
+
- node-csv `relax_quotes` config
|
|
14
|
+
|
|
15
|
+
## [4.3.1] - 2023-06-06
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
- Ignore system directories within zip file
|
|
20
|
+
|
|
21
|
+
### Updated
|
|
22
|
+
|
|
23
|
+
- Dependency updates
|
|
24
|
+
|
|
8
25
|
## [4.3.0] - 2023-05-04
|
|
9
26
|
|
|
10
27
|
### Updated
|
package/lib/gtfs/shapes.js
CHANGED
|
@@ -22,10 +22,10 @@ function buildTripSubquery(query) {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
/*
|
|
25
|
-
* Returns array of shapes that match the query parameters. A `route_id`
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
25
|
+
* Returns array of shapes that match the query parameters. A `route_id` query
|
|
26
|
+
* parameter may be passed to find all shapes for a route. A `trip_id` query
|
|
27
|
+
* parameter may be passed to find all shapes for a trip. A `direction_id`
|
|
28
|
+
* query parameter may be passed to find all shapes for a direction.
|
|
29
29
|
*/
|
|
30
30
|
export function getShapes(query = {}, fields = [], orderBy = [], options = {}) {
|
|
31
31
|
const db = options.db ?? openDb();
|
|
@@ -68,7 +68,9 @@ export function getShapes(query = {}, fields = [], orderBy = [], options = {}) {
|
|
|
68
68
|
|
|
69
69
|
/*
|
|
70
70
|
* Returns geoJSON of the shapes that match the query parameters. A `route_id`
|
|
71
|
-
* query parameter may be passed to find all shapes for a route.
|
|
71
|
+
* query parameter may be passed to find all shapes for a route. A `trip_id`
|
|
72
|
+
* query parameter may be passed to find all shapes for a trip. A
|
|
73
|
+
* `direction_id` query parameter may be passed to find all shapes for a direction.
|
|
72
74
|
*/
|
|
73
75
|
export function getShapesAsGeoJSON(query = {}, options = {}) {
|
|
74
76
|
const agencies = getAgencies({}, [], [], options);
|
package/lib/gtfs/stops.js
CHANGED
|
@@ -29,7 +29,8 @@ function buildStoptimeSubquery(query) {
|
|
|
29
29
|
* Returns an array of stops that match the query parameters. A `route_id`
|
|
30
30
|
* query parameter may be passed to find all shapes for a route. A `trip_id`
|
|
31
31
|
* query parameter may be passed to find all shapes for a trip. A
|
|
32
|
-
* `direction_id` query parameter may be passed to find all shapes for a
|
|
32
|
+
* `direction_id` query parameter may be passed to find all shapes for a
|
|
33
|
+
* direction.
|
|
33
34
|
*/
|
|
34
35
|
export function getStops(query = {}, fields = [], orderBy = [], options = {}) {
|
|
35
36
|
const db = options.db ?? openDb();
|
|
@@ -73,8 +74,10 @@ export function getStops(query = {}, fields = [], orderBy = [], options = {}) {
|
|
|
73
74
|
}
|
|
74
75
|
|
|
75
76
|
/*
|
|
76
|
-
* Returns geoJSON with stops
|
|
77
|
-
*
|
|
77
|
+
* Returns geoJSON with stops. A `route_id` query parameter may be passed to
|
|
78
|
+
* find all shapes for a route. A `trip_id` query parameter may be passed to
|
|
79
|
+
* find all shapes for a trip. A `direction_id` query parameter may be passed
|
|
80
|
+
* to find all shapes for a direction.
|
|
78
81
|
*/
|
|
79
82
|
export function getStopsAsGeoJSON(query = {}, options = {}) {
|
|
80
83
|
const db = options.db ?? openDb();
|
package/lib/import.js
CHANGED
|
@@ -264,7 +264,9 @@ const readFiles = async (task) => {
|
|
|
264
264
|
// If no .txt files in this directory, check for subdirectories and copy them here
|
|
265
265
|
if (textFiles.length === 0) {
|
|
266
266
|
const files = await readdir(task.downloadDir);
|
|
267
|
+
// Ignore system directories within zip file
|
|
267
268
|
const folders = files
|
|
269
|
+
.filter((filename) => !['__MACOSX'].includes(filename))
|
|
268
270
|
.map((filename) => path.join(task.downloadDir, filename))
|
|
269
271
|
.filter((source) => lstatSync(source).isDirectory());
|
|
270
272
|
|
|
@@ -528,7 +530,7 @@ const importFiles = (task) =>
|
|
|
528
530
|
const maxInsertVariables = 800;
|
|
529
531
|
const parser = parse({
|
|
530
532
|
columns: true,
|
|
531
|
-
|
|
533
|
+
relax_quotes: true,
|
|
532
534
|
trim: true,
|
|
533
535
|
skip_empty_lines: true,
|
|
534
536
|
...task.csvOptions,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gtfs",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.2",
|
|
4
4
|
"description": "Import GTFS transit data into SQLite and query routes, stops, times, fares and more",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"transit",
|
|
@@ -74,9 +74,9 @@
|
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
76
|
"@turf/helpers": "^6.5.0",
|
|
77
|
-
"better-sqlite3": "^8.
|
|
78
|
-
"csv-parse": "^5.
|
|
79
|
-
"csv-stringify": "^6.
|
|
77
|
+
"better-sqlite3": "^8.4.0",
|
|
78
|
+
"csv-parse": "^5.4.0",
|
|
79
|
+
"csv-stringify": "^6.4.0",
|
|
80
80
|
"gtfs-realtime-bindings": "^1.1.1",
|
|
81
81
|
"lodash-es": "^4.17.21",
|
|
82
82
|
"long": "^5.2.3",
|
|
@@ -90,14 +90,14 @@
|
|
|
90
90
|
"sqlstring-sqlite": "^0.1.1",
|
|
91
91
|
"strip-bom-stream": "^5.0.0",
|
|
92
92
|
"tmp-promise": "^3.0.3",
|
|
93
|
-
"untildify": "^
|
|
94
|
-
"yargs": "^17.7.
|
|
93
|
+
"untildify": "^5.0.0",
|
|
94
|
+
"yargs": "^17.7.2",
|
|
95
95
|
"yoctocolors": "^1.0.0"
|
|
96
96
|
},
|
|
97
97
|
"devDependencies": {
|
|
98
98
|
"@types/better-sqlite3": "^7.6.4",
|
|
99
99
|
"dtslint": "^4.2.1",
|
|
100
|
-
"eslint": "^8.
|
|
100
|
+
"eslint": "^8.42.0",
|
|
101
101
|
"eslint-config-prettier": "^8.8.0",
|
|
102
102
|
"eslint-config-xo": "^0.43.1",
|
|
103
103
|
"husky": "^8.0.3",
|
|
@@ -65,8 +65,9 @@ describe('exportGtfs():', function () {
|
|
|
65
65
|
const parser = parse(
|
|
66
66
|
{
|
|
67
67
|
columns: true,
|
|
68
|
-
|
|
68
|
+
relax_quotes: true,
|
|
69
69
|
trim: true,
|
|
70
|
+
skip_empty_lines: true,
|
|
70
71
|
},
|
|
71
72
|
(error, data) => {
|
|
72
73
|
if (error) {
|
|
@@ -121,8 +122,9 @@ describe('exportGtfs():', function () {
|
|
|
121
122
|
const parser = parse(
|
|
122
123
|
{
|
|
123
124
|
columns: true,
|
|
124
|
-
|
|
125
|
+
relax_quotes: true,
|
|
125
126
|
trim: true,
|
|
127
|
+
skip_empty_lines: true,
|
|
126
128
|
},
|
|
127
129
|
(error, data) => {
|
|
128
130
|
if (error) {
|