gtfs 4.13.3 → 4.14.0
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/README.md +43 -27
- package/dist/bin/gtfs-export.js +135 -341
- package/dist/bin/gtfs-export.js.map +1 -1
- package/dist/bin/gtfs-import.js +260 -454
- package/dist/bin/gtfs-import.js.map +1 -1
- package/dist/bin/gtfsrealtime-update.js +210 -3226
- package/dist/bin/gtfsrealtime-update.js.map +1 -1
- package/dist/index.d.ts +23 -12
- package/dist/index.js +364 -457
- package/dist/index.js.map +1 -1
- package/dist/models/models.d.ts +2231 -0
- package/dist/models/models.js +3076 -0
- package/dist/models/models.js.map +1 -0
- package/package.json +18 -8
package/README.md
CHANGED
|
@@ -178,8 +178,9 @@ To find an agency's GTFS file, visit [transitfeeds.com](http://transitfeeds.com)
|
|
|
178
178
|
| `headers` | object | An object of HTTP headers in key:value format to use when fetching GTFS from the `url` specified. Optional. |
|
|
179
179
|
| `prefix` | string | A prefix to be added to every ID field maintain uniqueness when importing multiple GTFS from multiple agencies. Optional. |
|
|
180
180
|
| `exclude` | array | An array of GTFS file names (without `.txt`) to exclude when importing. Optional. |
|
|
181
|
-
| `
|
|
182
|
-
| `
|
|
181
|
+
| `realtimeAlerts` | object | An object containing a `url` field for GTFS-Realtime alerts and a `headers` field in key:value format to use when fetching GTFS-Realtime data. Optional. |
|
|
182
|
+
| `realtimeTripUpdates` | object | An object containing a `url` field for GTFS-Realtime trip updates and a `headers` field in key:value format to use when fetching GTFS-Realtime data. Optional. |
|
|
183
|
+
| `realtimeVehiclePositions` | object | An object containing a `url` field for GTFS-Realtime vehicle positions and a `headers` field in key:value format to use when fetching GTFS-Realtime data. Optional. |
|
|
183
184
|
|
|
184
185
|
- Specify a `url` to download GTFS:
|
|
185
186
|
|
|
@@ -187,7 +188,7 @@ To find an agency's GTFS file, visit [transitfeeds.com](http://transitfeeds.com)
|
|
|
187
188
|
{
|
|
188
189
|
"agencies": [
|
|
189
190
|
{
|
|
190
|
-
"url": "
|
|
191
|
+
"url": "https://opendata.somewhere.com/gtfs.zip"
|
|
191
192
|
}
|
|
192
193
|
]
|
|
193
194
|
}
|
|
@@ -199,7 +200,7 @@ To find an agency's GTFS file, visit [transitfeeds.com](http://transitfeeds.com)
|
|
|
199
200
|
{
|
|
200
201
|
"agencies": [
|
|
201
202
|
{
|
|
202
|
-
"url": "
|
|
203
|
+
"url": "https://opendata.somewhere.com/gtfs.zip",
|
|
203
204
|
"headers": {
|
|
204
205
|
"Content-Type": "application/json",
|
|
205
206
|
"Authorization": "bearer 1234567890"
|
|
@@ -246,19 +247,30 @@ To find an agency's GTFS file, visit [transitfeeds.com](http://transitfeeds.com)
|
|
|
246
247
|
}
|
|
247
248
|
```
|
|
248
249
|
|
|
249
|
-
- Specify urls for GTFS-Realtime updates. `
|
|
250
|
+
- Specify urls for GTFS-Realtime updates. `realtimeAlerts`, `realtimeTripUpdates` and `realtimeVehiclePositions` fields accept an object with a `url` and optional `headers` field to specify HTTP headers to include with the request, usually for authorization purposes.
|
|
250
251
|
|
|
251
252
|
```json
|
|
252
253
|
{
|
|
253
254
|
"agencies": [
|
|
254
255
|
{
|
|
255
|
-
"url": "
|
|
256
|
-
"
|
|
257
|
-
"https://opendata.somewhere.com/gtfs-rt/
|
|
258
|
-
"
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
256
|
+
"url": "https://opendata.somewhere.com/gtfs.zip",
|
|
257
|
+
"realtimeAlerts": {
|
|
258
|
+
"url": "https://opendata.somewhere.com/gtfs-rt/alerts",
|
|
259
|
+
"headers": {
|
|
260
|
+
"Authorization": "bearer 123456789"
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
"realtimeTripUpdates": {
|
|
264
|
+
"url": "https://opendata.somewhere.com/gtfs-rt/tripupdates",
|
|
265
|
+
"headers": {
|
|
266
|
+
"Authorization": "bearer 123456789"
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
"realtimeVehiclePositions": {
|
|
270
|
+
"url": "https://opendata.somewhere.com/gtfs-rt/vehiclepositions",
|
|
271
|
+
"headers": {
|
|
272
|
+
"Authorization": "bearer 123456789"
|
|
273
|
+
}
|
|
262
274
|
}
|
|
263
275
|
}
|
|
264
276
|
]
|
|
@@ -389,11 +401,15 @@ importGtfs({
|
|
|
389
401
|
"agencies": [
|
|
390
402
|
{
|
|
391
403
|
"url": "https://agency.com/gtfs.zip",
|
|
392
|
-
"
|
|
393
|
-
"https://
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
404
|
+
"realtimeAlerts": {
|
|
405
|
+
"url": "https://opendata.somewhere.com/gtfs-rt/alerts"
|
|
406
|
+
},
|
|
407
|
+
"realtimeTripUpdates": {
|
|
408
|
+
"url": "https://opendata.somewhere.com/gtfs-rt/tripupdates"
|
|
409
|
+
},
|
|
410
|
+
"realtimeVehiclePositions": {
|
|
411
|
+
"url": "https://opendata.somewhere.com/gtfs-rt/vehiclepositions"
|
|
412
|
+
}
|
|
397
413
|
}
|
|
398
414
|
],
|
|
399
415
|
"gtfsRealtimeExpirationSeconds": false
|
|
@@ -462,7 +478,7 @@ import { importGtfs } from 'gtfs';
|
|
|
462
478
|
const config = {
|
|
463
479
|
agencies: [
|
|
464
480
|
{
|
|
465
|
-
url: '
|
|
481
|
+
url: 'https://opendata.somewhere.com/gtfs.zip',
|
|
466
482
|
exclude: ['shapes'],
|
|
467
483
|
},
|
|
468
484
|
],
|
|
@@ -512,7 +528,7 @@ const config = {
|
|
|
512
528
|
sqlitePath: '/dev/sqlite/gtfs',
|
|
513
529
|
agencies: [
|
|
514
530
|
{
|
|
515
|
-
url: '
|
|
531
|
+
url: 'https://opendata.somewhere.com/gtfs.zip',
|
|
516
532
|
exclude: ['shapes'],
|
|
517
533
|
},
|
|
518
534
|
],
|
|
@@ -592,7 +608,7 @@ const config = {
|
|
|
592
608
|
sqlitePath: '/dev/sqlite/gtfs',
|
|
593
609
|
agencies: [
|
|
594
610
|
{
|
|
595
|
-
url: '
|
|
611
|
+
url: 'https://opendata.somewhere.com/gtfs.zip',
|
|
596
612
|
exclude: ['shapes'],
|
|
597
613
|
},
|
|
598
614
|
],
|
|
@@ -1565,15 +1581,15 @@ const boardAlights = getBoardAlights({
|
|
|
1565
1581
|
});
|
|
1566
1582
|
```
|
|
1567
1583
|
|
|
1568
|
-
####
|
|
1584
|
+
#### getRideFeedInfo(query, fields, sortBy, options)
|
|
1569
1585
|
|
|
1570
1586
|
Returns an array of ride_feed_info that match query parameters. [Details on ride_feed_info.txt](http://gtfsride.org/specification#ride_feed_infotxt)
|
|
1571
1587
|
|
|
1572
1588
|
```js
|
|
1573
|
-
import {
|
|
1589
|
+
import { getRideFeedInfo } from 'gtfs';
|
|
1574
1590
|
|
|
1575
1591
|
// Get all ride_feed_info
|
|
1576
|
-
const rideFeedInfos =
|
|
1592
|
+
const rideFeedInfos = getRideFeedInfo();
|
|
1577
1593
|
```
|
|
1578
1594
|
|
|
1579
1595
|
#### getRiderTrips(query, fields, sortBy, options)
|
|
@@ -1592,18 +1608,18 @@ const riderTrips = getRiderTrips({
|
|
|
1592
1608
|
});
|
|
1593
1609
|
```
|
|
1594
1610
|
|
|
1595
|
-
####
|
|
1611
|
+
#### getRidership(query, fields, sortBy, options)
|
|
1596
1612
|
|
|
1597
1613
|
Returns an array of ridership that match query parameters. [Details on ridership.txt](http://gtfsride.org/specification#ridershiptxt)
|
|
1598
1614
|
|
|
1599
1615
|
```js
|
|
1600
|
-
import {
|
|
1616
|
+
import { getRidership } from 'gtfs';
|
|
1601
1617
|
|
|
1602
1618
|
// Get all ridership
|
|
1603
|
-
const riderships =
|
|
1619
|
+
const riderships = getRidership();
|
|
1604
1620
|
|
|
1605
1621
|
// Get ridership for a specific route
|
|
1606
|
-
const riderships =
|
|
1622
|
+
const riderships = getRidership({
|
|
1607
1623
|
route_id: '123',
|
|
1608
1624
|
});
|
|
1609
1625
|
```
|