Giter VIP home page Giter VIP logo

gtfs-to-html's Introduction

➡️ Documentation | Quick Start | Configuration | Questions and Support ⬅️

GTFS-to-HTML



Create human-readable, user-friendly transit timetables in HTML, PDF or CSV format directly from GTFS.

NPM


See gtfstohtml.com for full documentation.

Most transit agencies have schedule data in GTFS format but need to show each route's schedule to users on a website. GTFS-to-HTML automates the process of creating nicely formatted HTML timetables for inclusion on a transit agency website. This makes it easy to keep timetables up to date and accurate when schedule changes happen and reduces the likelihood of errors.

Features

Configurable and customizable

gtfs-to-html has many options that configure how timetables are presented. It also allows using a completely custom template which makes it easy to build chunks of HTML that will fit perfectly into any website using any HTML structure and classes that you'd like. Or, create printable PDF versions or CSV exports of timetables using the outputFormat config option.

Accessibility for all

gtfs-to-html properly formats timetables to ensure they are screen-reader accessible and WCAG 2.0 compliant.

Mobile responsiveness built in

Built-in styling makes gtfs-to-html timetables ready to size and scroll easily on mobile phones and tablets.

Schedule changes? A cinch.

By generating future timetables and including dates in table metadata, your timetables can appear in advance of a schedule change, and you can validate that your new timetables and GTFS are correct.

Auto-generated maps

gtfs-to-html can also generate a map for each route that can be included with the schedule page. The map shows all stops for the route and lists all routes that serve each stop. See the showMap configuration option below.

Note: If you only want maps of GTFS data, use the gtfs-to-geojson package instead and skip making timetables entirely. If offers many different formats of GeoJSON for routes and stops.

gtfs-to-html uses the node-gtfs library to handle importing and querying GTFS data.

GTFS-to-HTML on the web

You can now use gtfs-to-html without actually downloading any code or doing any configuration. run.gtfstohtml.com provides a web based interface for finding GTFS feeds for agencies, setting configuration and then generates a previewable and downloadable set of timetables.

Current Usage

Many transit agencies use gtfs-to-html to generate the schedule pages used on their websites, including:

Are you using gtfs-to-html? Let us know via email ([email protected]) or via opening a github issue or pull request if your agency is using this library.

gtfs-to-html is used as an integral part of transit-custom-posts - a GTFS-optimized Wordpress plugin for transit websites.

Installation, Configuration and Usage documentation

See GTFS-to-HTML Documentation

Changelog

See Changelog

Contributing

Pull requests are welcome, as well as feedback and reporting issues.

Tests

npm test

gtfs-to-html's People

Contributors

0xflotus avatar brendannee avatar dependabot[bot] avatar ed-g avatar evansiroky avatar floatingpurr avatar nselikoff avatar pawajoro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gtfs-to-html's Issues

No trips found for route_id

Seemed to be working fine until the latest batch of GTFS data. Now I'm getting "no trips found" error. I tried removing the offending route from routes.txt, but the next one then throws the error.

Starting GTFS import for 1 file
[agency]: Importing GTFS from /Users/[username]/GTFStoHTML/node_modules/gtfs-to-html/google_transit.zip
[agency]: Importing - agency.txt - 1 lines imported
[agency]: Importing - calendar_dates.txt - 17 lines imported
[agency]: Importing - calendar.txt - 10 lines imported
[agency]: Importing - fare_attributes.txt - 2 lines imported
[agency]: Importing - fare_rules.txt - 127 lines imported
[agency]: Importing - feed_info.txt - No file found
[agency]: Importing - frequencies.txt - No file found
[agency]: Importing - routes.txt - 124 lines imported
[agency]: Importing - shapes.txt - 277274 lines imported
[agency]: Importing - stop_times.txt - 415019 lines imported
[agency]: Importing - stops.txt - 2874 lines imported
[agency]: Importing - transfers.txt - No file found
[agency]: Importing - trips.txt - 2339 lines imported
[agency]: Post Processing data
[agency]: Completed GTFS import
Completed GTFS import for 1 file
Error: No trips found for route_id=8857, direction_id=0, service_ids=["3_merged_1023652"], timetable_id=8857_1111100_0
at getTripsFromTimetable (/Users/[username]/GTFStoHTML/node_modules/gtfs-to-html/lib/utils.js:365:11)
at
at process._tickCallback (internal/process/next_tick.js:188:7)

Add timetable output messages - # of trips, routes, patterns, stops, etc.

Feature request: When the GTFS-to-HTML software runs, add to the output messages with some statistics about each timetable, e.g. number of:

  • routes
  • directions
  • trips
  • patterns
  • stops and/or timepoints

This provides a high-level report to quickly "sanity check" output (and compare to previous outputs).

Timetable pages grouping multiple timetables

an agency can feasibly use the html output direct from gtfs-to-html as the "route page" on their website, although this likely wouldn't be advisable currently unless budgets were very small.

however, such agencies likely want a "route 2" page, as opposed to 4 different pages for each direction/weekday vs. weekend.

A tool grouping various timetables together as separate tables within the same file and body tag could make the direct outputs more immediately usable by some agencies.

no time table

how can i trouble shoot missing time table?. I get the list of route but that s it.

Better format for listing days "service not provided on"

Currently, there is a list of dates like:

Service not provided on:
Mon, Jul 4, 2016
Mon, Sep 5, 2016
Thu, Nov 24, 2016
Fri, Nov 25, 2016
Sat, Dec 24, 2016
Sun, Dec 25, 2016
Sat, Dec 31, 2016

These could be grouped to make them more concise and take up less space:

Service not provided on:
Jul 4, Sep 5, Nov 24-25, Dec 24-25, Dec 31, 2016

@antrim What do you think? Do you have a better suggested format?

Times not shown for stops with times

I working with the GTFS at data.trilliumtransit.com/gtfs/beloittransit-wi-us/beloittransit-wi-us-test.zip

See timetables and config.json below.

Notes

  • timetable_stop_order.txt is present but incomplete. I'm guessing this is not a problem but if timetable_stop_order needs to include references to all timetables, that could be my problem.
  • the config.json has "showOnlyTimepoint": true, and for the timetables in timetable_stop_order.txt, only the timepoints are in the file (I also tested including non-timepoints for those timetables in the file, but that forced them to be shown)
  • only 12272016 forward timetables are included in zip
  • these trips are exported as a group from our system, so I'm moderately confident that all the empty timepoints have times (and I've manually checked a few)

any ideas? cc @NomeQ

beloit1.zip

GTFS attempting to delete my downloads folder

I'm walking through this for the first time, and I finally think I got everything installed correctly. However, when I run gtfs-to-html, I get an error "Error: EACCES: permission denied, rmdir '/Users/{myusername}/downloads'. I'm running on MacOS X 10.11.6. Due to the nature of the folder, I definitely do NOT want to give it the ability to do this (as this is where all Downloads from Safari go. I originally thought it was due to setting a url to our data. However, after switching to a local path in config.json, I'm still receiving the error.

Automatically generated timetables contain all services in one timetable

When the timetables are automatically generated (i.e. no use of timetables.txt, timetable_pages.txt, etc), all days / service patterns are included in one timetable. If a route has different service on weekdays, Saturdays, and Sundays (for example), this can lead to what appears to be duplicate data in the table.

Example feed exhibiting this behavior:

  "agencies": [
    {
      "agency_key": "lynx",
      "url": "https://transitfeeds.com/p/central-florida-regional-transportation-authority/373/latest/download"
    }
  ],

Route alignments/shapes on maps

The maps currently only provide stop locations. Is it feasible to include alignments as well, or does this become too much data to load when shapes are long/contain too many points?

Open thread: refine how days-of-service are indicated

Proposal: The days of week summary (e.g. Mon-Fri) that appears at the top of the timetable should be inclusive of all days that transit service operates.

Issue: We currently see a different behavior with some YARTS timetables (http://transitfeeds.com/p/yosemite-area-regional-transportation-system/155, 12-Oct-2015). Screenshot below. Note that this timetable encompasses service periods for different months, which is somewhat unusual.

Alternative: We could choose to produce these timetables differently, and choose a more standard approach where we split into separate timetables for distinct parts of the season. Currently, we are just trying to match their approach with the printed timetables.

timetable for 120e-395

#### excerpt from calendar.txt
service_id service_name monday tuesday wednesday thursday friday saturday sunday start_date end_date
781A4094 Hwy 120/395 - July/Aug 2014 (Mon-Sun) 1 1 1 1 1 1 1 20160701 20160831
782A4091 Hwy 120/395 - June&Sept 2014 (Sat-Sun) 0 0 0 0 0 1 1 20160601 20170928

excerpt from timetables.txt

timetable_id route_id direction_id start_date end_date monday tuesday wednesday thursday friday saturday sunday route_label service_notes direction_label
12 582 0 20160601 20170928 0 0 0 0 0 1 1 Mammoth Lakes HWY 120E-395 Hwy 120-395 - June&Sept 2014 Outbound
13 582 1 20160601 20170928 0 0 0 0 0 1 1 Mammoth Lakes HWY 120E-395 Hwy 120-395 - June&Sept 2014 Inbound
14 582 0 20160701 20160831 1 1 1 1 1 1 1 Mammoth Lakes HWY 120E-395 Hwy 120-395 - July-Aug 2014 Outbound
15 582 1 20160701 20160831 1 1 1 1 1 1 1 Mammoth Lakes HWY 120E-395 Hwy 120-395 - July-Aug 2014 Inbound

Discussion: Legend

Should we add an option to output a legend that explains symbols? This could also be made part of #34 .

Trips sorting order

We have an issue when a trip begins at a stop in the middle of the timetable's stop order.

The timetables have trips sorted by the first stop time, without taking into account which stop is first for each trip. This results in some rows showing times out of order as they're read left to right. See below at "HSU Library Circle" and rows below that.

We propose that the trips be sorted by the stop time of the first stop every trip has in common. For example, sorting the trips shown below by the stop times at "HSU Library Circle".

screen shot 2017-06-15 at 6 10 09 pm

$and/$nor/$or must be a nonempty array

Using the following config.json:

{
  "mongoUrl": "mongodb://localhost:27017/ripta",
  "agencies": [
    {
      "agency_key": "rhode-island-public-transit-authority",
      "url": "http://transitfeeds.com/p/rhode-island-public-transit-authority/363/latest/download"
    }
  ],
  "beautify": true,
  "coordinatePrecision": 5,
  "effectiveDate": "July 8, 2016",
  "menuType": "jump",
  "noServiceSymbol": "",
  "requestStopSymbol": "***",
  "showMap": true,
  "showOnlyTimepoint": true,
  "showStopCity": false,
  "mapboxAccessToken": "pk.eyJ1IjoiemFja2tyaWRhIiwiYSI6ImNqNWticTdlODF6MGYycWxtaWRqMGNlNnYifQ.hNazsLyjg5s20C6vwOEZKg",
  "zipOutput": false
}

and running gtfs-to-html --configPath config.json, I get the following output:

Starting GTFS import for 1 file
rhode-island-public-transit-authority: Downloading GTFS from http://transitfeeds.com/p/rhode-island-public-transit-authority/363/latest/download
rhode-island-public-transit-authority: Download successful
rhode-island-public-transit-authority: Importing GTFS from /Users/developers/Desktop/ripta-gts-html-test/downloads/rhode-island-public-transit-authority-gtfs.zip
rhode-island-public-transit-authority: Importing - agency.txt - 1 lines imported
rhode-island-public-transit-authority: Importing - calendar_dates.txt - 207 lines imported
rhode-island-public-transit-authority: Importing - calendar.txt - No file found
rhode-island-public-transit-authority: Importing - fare_attributes.txt - No file found
rhode-island-public-transit-authority: Importing - fare_rules.txt - No file found
rhode-island-public-transit-authority: Importing - feed_info.txt - No file found
rhode-island-public-transit-authority: Importing - frequencies.txt - No file found
rhode-island-public-transit-authority: Importing - routes.txt - 54 lines imported
rhode-island-public-transit-authority: Importing - shapes.txt - 102424 lines imported
rhode-island-public-transit-authority: Importing - stop_times.txt - 235391 lines imported
rhode-island-public-transit-authority: Importing - stops.txt - 3612 lines imported
rhode-island-public-transit-authority: Importing - transfers.txt - No file found
rhode-island-public-transit-authority: Importing - trips.txt - 5616 lines imported
rhode-island-public-transit-authority: Post Processing data
rhode-island-public-transit-authority: Completed
Completed GTFS import for 1 file
{ MongoError: $and/$or/$nor must be a nonempty arrayof 107 HTML schedules
    at Function.MongoError.create (/usr/local/lib/node_modules/gtfs-to-html/node_modules/mongodb-core/lib/error.js:31:11)
    at queryCallback (/usr/local/lib/node_modules/gtfs-to-html/node_modules/mongodb-core/lib/cursor.js:212:36)
    at /usr/local/lib/node_modules/gtfs-to-html/node_modules/mongodb-core/lib/connection/pool.js:469:18
    at _combinedTickCallback (internal/process/next_tick.js:95:7)
    at process._tickCallback (internal/process/next_tick.js:161:9)
  name: 'MongoError',
  message: '$and/$or/$nor must be a nonempty array',
  ok: 0,
  errmsg: '$and/$or/$nor must be a nonempty array',
  code: 2,
  codeName: 'BadValue' }

Any ideas? Thanks for any help!

Filtered timetable_stop_order not correct

I'm struggling to understand where this break might be happening because Im not sure where to look anymore. The timetables for one particular route in which I am filtering out some specific time points is not matching up, generating a timetable with '---' in place of the time that should be there.

I've cross-checked it numerous times making sure the stop_id matches, and it does, but when I run the command the new timetables do not include the stop_id points I'm declaring.

I've attached an image showing part of the unfiltered timetable, direct from the normal gtfs feed, and part of the new filtered timetable. You'll see the stop codes match under the location names.

I'm just not sure where to look to get a better understanding. Any help appreciated. I can also attached the feed if necessary. Thanks!

James

gtfs-to-html-result

Printing Code Snippets in HTML

With the most recent version, I have been getting code printed in the HTML itself, e.g.
col class="run_#{idx} #{(trip.trip_short_name) ? 'trip_short_name_' + trip.trip_short_name : ''}" id="trip_id_#{trip.trip_id}">
Additionally, on this GTFS data a lot of stop times were missing beyond the first row and marked as No Service at this Timepoint.

I rolled back to a much earlier commit (from the config.js era of GTFS-to-HTML) and it was able to correctly parse the GTFS and produced accurate timetables. I've attached the GTFS data in question as well as the same timetable produced both by the current version and the old version.
nwconnector-or-us.zip
timetables.zip

SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode

Hey there, I've cloned and set up the repo + mongodb, but when I npm run gtfs-to-html I'm getting the following error:

/gtfs-to-html/scripts/gtfs-to-html.js:26
    let timetablePages;
    ^^^

SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:373:25)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Function.Module.runMain (module.js:441:10)
    at startup (node.js:139:18)
    at node.js:974:3

I'm on node 4.6.1, npm 3.10.9. I've tried running the script with node directly using --use_strict but that breaks some of the other dependencies.

Option: Use trip_short_name in place of Run #

It would be helpful to have the option of displaying the trip_short_name in the column header in place of Run # 1, Run # 2, etc. This makes sense in cases where the agency uses customer-facing numbers for trips.

don't show duplicate holiday exceptions

Duplicate holiday exceptions are shown:
holidays

This might be an artifact of the GTFS, but as feed_validator.py is not throwing an error, I recommend that GTFS-to-HTML should only show distinct exception dates.

Discussion: footnotes?

Should we use a timetable_notes.txt file that allows referencing specific timetables, stops, and trips to add footnotes on a timetable?

(Updated: notes.txt -> timetable_notes.txt)

sortedTrips doesn't see stoptimes for a trip?

Ran into trouble generating html for Humboldt county.

Simones-MacBook-Air:redwood_test hollykvalheim$ npm list -g gtfs-to-html
/usr/local/lib
└── [email protected] 

$ cat config.json

{
  "mongoUrl": "mongodb://localhost:27017/gtfs",
  "agencies": [
    {
      "agency_key": "Sonoma County",
      "url": "http://data.trilliumtransit.com/gtfs/humboldtcounty-ca-us/humboldtcounty-ca-us.zip"
    }
  ],
  "beautify": false,
  "coordinatePrecision": 5,
  "effectiveDate": "July 8, 2016",
  "menuType": "jump",
  "noServiceSymbol": "",
  "requestStopSymbol": "***",
  "showMap": false,
  "showOnlyTimepoint": true,
  "showStopCity": false,
  "mapboxAccessToken": "YOUR MAPBOX ACCESS TOKEN'",
  "zipOutput": false
}
$ gtfs-to-html |tee gtfs-to-html.log  2>&1 
Starting GTFS import for 1 file
Sonoma County: Downloading GTFS from http://data.trilliumtransit.com/gtfs/humboldtcounty-ca-us/humboldtcounty-ca-us.zip
Sonoma County: Download successful
Sonoma County: Importing GTFS from /Users/hollykvalheim/Timetables/redwood_test/downloads/Sonoma County-gtfs.zip
Sonoma County: Importing - agency.txt - 3 lines imported
Sonoma County: Importing - calendar_dates.txt - 53 lines imported
Sonoma County: Importing - calendar.txt - 8 lines imported
Sonoma County: Importing - fare_attributes.txt - 8 lines imported
Sonoma County: Importing - fare_rules.txt - 37 lines imported
Sonoma County: Importing - feed_info.txt - 1 lines imported
Sonoma County: Importing - frequencies.txt
Sonoma County: Importing - routes.txt - 13 lines imported
Sonoma County: Importing - shapes.txt - 38380 lines imported
Sonoma County: Importing - stop_times.txt - 9531 lines imported
Sonoma County: Importing - stops.txt - 349 lines imported
Sonoma County: Importing - transfers.txt - 8 lines imported
Sonoma County: Importing - trips.txt - 329 lines imported
Sonoma County: Importing - stop_attributes.txt - 810 lines imported
Sonoma County: Post Processing data
Sonoma County: Completed
Completed GTFS import for 1 file
sortedTrips TRILLIUM DEBUG trip:  { _id: 597271abf64eee3b699e3630,
  route_id: '8',
  service_id: 'c_10_b_525_d_31',
  trip_id: 't_44_b_525_tn_0',
  trip_short_name: '',
  trip_headsign: 'Arcata (Westbound)',
  direction_id: 0,
  block_id: '8276',
  shape_id: 'p_470',
  bikes_allowed: null,
  wheelchair_accessible: null,
  trip_type: '',
  agency_key: 'Sonoma County',
  calendar: 
   { _id: 597271a8f64eee3b699d78e0,
     service_id: 'c_10_b_525_d_31',
     service_name: 'Year round calendar (Monday-Friday)',
     monday: 1,
     tuesday: 1,
     wednesday: 1,
     thursday: 1,
     friday: 1,
     saturday: 0,
     sunday: 0,
     start_date: 20140101,
     end_date: 20180101,
     agency_key: 'Sonoma County' },
  dayList: 'Mon-Fri',
  stoptimes: [] }
sortedTrips TRILLIUM DEBUG selectedStoptime:  undefined
TypeError: Cannot read property 'departure_time' of undefined
    at _.sortBy.trip (/usr/local/lib/node_modules/gtfs-to-html/lib/utils.js:63:35)
    at /usr/local/lib/node_modules/gtfs-to-html/node_modules/lodash/lodash.js:3738:18
    at arrayMap (/usr/local/lib/node_modules/gtfs-to-html/node_modules/lodash/lodash.js:660:23)
    at /usr/local/lib/node_modules/gtfs-to-html/node_modules/lodash/lodash.js:3737:24
    at /usr/local/lib/node_modules/gtfs-to-html/node_modules/lodash/lodash.js:3554:27
    at /usr/local/lib/node_modules/gtfs-to-html/node_modules/lodash/lodash.js:4920:15
    at baseMap (/usr/local/lib/node_modules/gtfs-to-html/node_modules/lodash/lodash.js:3553:7)
    at baseOrderBy (/usr/local/lib/node_modules/gtfs-to-html/node_modules/lodash/lodash.js:3736:20)
    at Function.<anonymous> (/usr/local/lib/node_modules/gtfs-to-html/node_modules/lodash/lodash.js:9956:14)
    at apply (/usr/local/lib/node_modules/gtfs-to-html/node_modules/lodash/lodash.js:496:27)
    at Function.sortBy (/usr/local/lib/node_modules/gtfs-to-html/node_modules/lodash/lodash.js:6600:16)
    at sortTrips (/usr/local/lib/node_modules/gtfs-to-html/lib/utils.js:53:25)
    at Promise.all.timetablePage.timetables.map (/usr/local/lib/node_modules/gtfs-to-html/lib/utils.js:483:30)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:169:7)

The trip appears to have stoptimes according to mongodb. The same trip exists in multiple agencies, could that be causing trouble?


Simones-MacBook-Air:redwood_test hollykvalheim$ mongo
MongoDB shell version v3.4.4
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.4.4
Server has startup warnings: 
2017-07-19T18:12:17.459-0700 I CONTROL  [initandlisten] 
2017-07-19T18:12:17.459-0700 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2017-07-19T18:12:17.459-0700 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2017-07-19T18:12:17.459-0700 I CONTROL  [initandlisten] 
2017-07-19T18:12:17.459-0700 I CONTROL  [initandlisten] 
2017-07-19T18:12:17.459-0700 I CONTROL  [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
> use gtfs
switched to db gtfs
> db.stoptimes.find( { trip_id: 't_44_b_525_tn_0' })
{ "_id" : ObjectId("5931da2dd8d70c3040c3b081"), "trip_id" : "t_44_b_525_tn_0", "arrival_time" : "17:30:00", "departure_time" : "17:30:00", "stop_id" : "1260", "stop_sequence" : 2, "stop_headsign" : "", "pickup_type" : 1, "drop_off_type" : 0, "shape_dist_traveled" : 40.8227099812685, "timepoint" : 0, "agency_key" : "Humboldt Transit Authority" }
{ "_id" : ObjectId("5931da2dd8d70c3040c3b082"), "trip_id" : "t_44_b_525_tn_0", "arrival_time" : "16:45:00", "departure_time" : "16:45:00", "stop_id" : "1283", "stop_sequence" : 1, "stop_headsign" : "", "pickup_type" : 0, "drop_off_type" : 1, "shape_dist_traveled" : 0, "timepoint" : 0, "agency_key" : "Humboldt Transit Authority" }
{ "_id" : ObjectId("597271abf64eee3b699e29c2"), "trip_id" : "t_44_b_525_tn_0", "arrival_time" : "17:30:00", "departure_time" : "17:30:00", "stop_id" : "1260", "stop_sequence" : 2, "stop_headsign" : "", "pickup_type" : 1, "drop_off_type" : 0, "shape_dist_traveled" : 40.8227099812685, "timepoint" : 0, "agency_key" : "Sonoma County" }
{ "_id" : ObjectId("597271abf64eee3b699e29c3"), "trip_id" : "t_44_b_525_tn_0", "arrival_time" : "16:45:00", "departure_time" : "16:45:00", "stop_id" : "1283", "stop_sequence" : 1, "stop_headsign" : "", "pickup_type" : 0, "drop_off_type" : 1, "shape_dist_traveled" : 0, "timepoint" : 0, "agency_key" : "Sonoma County" }

Getting "TypeError: Cannot convert undefined or null to object" when running gtfs-to-html

Hi there,

I'm currently having an issue when running gtfs-to-html which will prompt me with the following error:

Starting GTFS import for 1 file
TypeError: Cannot convert undefined or null to object
    at Function.assign (<anonymous>)
    at executeOperation (C:\Users\smarcotte\AppData\Roaming\npm\node_modules\gtfs-to-html\node_modules\mongodb\lib\utils.js:386:14)
    at Collection.remove (C:\Users\smarcotte\AppData\Roaming\npm\node_modules\gtfs-to-html\node_modules\mongodb\lib\collection.js:1239:10)
    at NativeCollection.(anonymous function) [as remove] (C:\Users\smarcotte\AppData\Roaming\npm\node_modules\gtfs-to-html\node_modules\mongoose\lib\drivers\node-mongodb-native\collection.js:139:28)
    at Promise.all.models.map.model (C:\Users\smarcotte\AppData\Roaming\npm\node_modules\gtfs-to-html\node_modules\gtfs\lib\import.js:53:35)
    at Array.map (<anonymous>)
    at removeData (C:\Users\smarcotte\AppData\Roaming\npm\node_modules\gtfs-to-html\node_modules\gtfs\lib\import.js:52:29)
    at Object.module.exports [as import] (C:\Users\smarcotte\AppData\Roaming\npm\node_modules\gtfs-to-html\node_modules\gtfs\lib\import.js:323:13)
    at <anonymous>

Here is my config file:

{
  "mongoUrl": "mongodb://localhost:27017/gtfs",
  "agencies": [
    {
      "agency_key": "stm3",
      "path": "gtfs/gtfs_stm.zip"
    }
  ],
  "beautify": false,
  "coordinatePrecision": 5,
  "effectiveDate": "July 8, 2016",
  "menuType": "jump",
  "noServiceSymbol": "—",
  "requestStopSymbol": "***",
  "interpolatedStopSymbol": "•",
  "showMap": false,
  "showOnlyTimepoint": false,
  "showStopCity": false,
  "mapboxAccessToken": "",
  "zipOutput": false
}

And here is the mongod log:

2018-02-27T18:00:49.620-0500 I NETWORK  [listener] connection accepted from 127.0.0.1:50579 #6 (6 connections now open)
2018-02-27T18:00:49.648-0500 I NETWORK  [conn6] received client metadata from 127.0.0.1:50579 conn: { driver: { name: "nodejs", version: "3.0.2" }, os: { type: "Windows_NT", name: "win32", architecture: "x64", version: "10.0.14393" }, platform: "Node.js v8.9.4,
 LE, mongodb-core: 3.0.2" }
2018-02-27T18:00:49.917-0500 I NETWORK  [conn6] end connection 127.0.0.1:50579 (5 connections now open)

Any help would be welcome. 😄

Show timetable_id in the exported timetables

We (Trillium) are interested in a change where timetable ID would be prepended to the filenames of the HTML timetables. This would help sync up with information in timetables.txt. This will be used in a WordPress extension that loads timetables.

.zip files generated by Mac

I'm running OS X 10.11.6 and when I create a zip file using the compression option gtfs-to-html fails (error below). It works fine if I use the .zip file that's posted to our transit feed. However, if I open the zip file and then immediately compress the contents, the resulting zip file generates an error. Is there some difference in the way the Mac compresses the file, or is there something else happening?

Starting GTFS import for 1 file
[Agency]: Importing GTFS from /[location]/google_transit.zip
[Agency]: Importing - agency.txt - No file found
[Agency]: Importing - calendar_dates.txt - No file found
[Agency]: Importing - calendar.txt - No file found
[Agency]: Importing - fare_attributes.txt - No file found
[Agency]: Importing - fare_rules.txt - No file found
[Agency]: Importing - feed_info.txt - No file found
[Agency]: Importing - frequencies.txt - No file found
[Agency]: Importing - routes.txt - No file found
[Agency]: Importing - shapes.txt - No file found
[Agency]: Importing - stop_times.txt - No file found
[Agency]: Importing - stops.txt - No file found
[Agency]: Importing - transfers.txt - No file found
[Agency]: Importing - trips.txt - No file found
[Agency]: Post Processing data
[Agency]: Completed GTFS import
Completed GTFS import for 1 file
Error: No agency found for agency_key=[Agency]
at Object.exports.generateOverviewHTML (/[location]/gtfs-to-html/lib/utils.js:586:11)
at
at process._tickCallback (internal/process/next_tick.js:188:7)

No file found?

I'm testing locally for a transit feed I've run gtfs-to-html successfully in the past, however I was using a URL. This time I'm just running it from a .zip folder on my computer. I know I have the path correct but it keeps saying "No file found" for any of the .txt files in the feed.zip folder. They are all there.

$ gtfs-to-html

Starting GTFS import for 1 file
testAgency: Importing GTFS from ~/Downloads/feed.zip
testAgency: Importing - agency.txt - No file found
testAgency: Importing - calendar_dates.txt - No file found
testAgency: Importing - calendar.txt - No file found
testAgency: Importing - fare_attributes.txt - No file found
testAgency: Importing - fare_rules.txt - No file found
testAgency: Importing - feed_info.txt - No file found
testAgency: Importing - frequencies.txt - No file found
testAgency: Importing - routes.txt - No file found
testAgency: Importing - shapes.txt - No file found
testAgency: Importing - stop_times.txt - No file found
testAgency: Importing - stops.txt - No file found
testAgency: Importing - transfers.txt - No file found
testAgency: Importing - trips.txt - No file found
testAgency: Post Processing data
testAgency: Completed GTFS import
Completed GTFS import for 1 file
Error: No agency found for agency_key=testAgency
at Object.exports.generateOverviewHTML (/usr/local/lib/node_modules/gtfs-to-html/lib/utils.js:769:11)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)

I'm trying to add the timetables.txt file for the first time. Hasn't worked yet. Any help appreciated.

"JavaScript heap out of memory"

I tried your tool on the Auckland Transport GTFS data (for Auckland, New Zealand), but I got this failure:

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

This is what the task manager shows:

image

Complete logs:

Generating HTML schedules for AT
Starting GTFS import for 1 file
AT: Importing GTFS from ./gtfs/
AT: Importing - agency.txt - 17 lines imported
AT: Importing - calendar_dates.txt - 149624 lines imported
AT: Importing - calendar.txt - 42664 lines imported
AT: Importing - fare_attributes.txt - No file found
AT: Importing - fare_rules.txt - No file found
AT: Importing - feed_info.txt
AT: Importing - frequencies.txt - No file found
AT: Importing - routes.txt - 2524 lines imported
AT: Importing - shapes.txt - 2148670 lines imported
AT: Importing - stop_times.txt - 1488810 lines imported
AT: Importing - stops.txt - 9896 lines imported
AT: Importing - transfers.txt - No file found
AT: Importing - trips.txt - 42664 lines imported
AT: Post Processing data
AT: Completed
Completed GTFS import for 1 file

<--- Last few GCs --->

[11640:000002382E0AFBE0]   741617 ms: Mark-sweep 1412.6 (1479.7) -> 1412.6 (1448.7) MB, 2345.1 / 0.0 ms  (+ 2.0 ms in 1 steps since start of marking, biggest step 2.0 ms) last resort gc
[11640:000002382E0AFBE0]   742567 ms: Mark-sweep 1412.6 (1448.7) -> 1412.6 (1448.7) MB, 949.7 / 0.0 ms  last resort gc


<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 000003F9A92C0D51 <JS Object>
    1: deserializeObject(aka deserializeObject) [C:\Users\Kyle\AppData\Roaming\npm\node_modules\mongoose\node_modules\mongodb-core\node_modules\bson\lib\bson\parser\deserializer.js:~39] [pc=000001190B8DEDB5](this=000003F9A9204311 <undefined>,buffer=000003C89C087439 <an Uint8Array with map 0000017C2101AA99>,index=12,options=000003C89C087409 <an Object with map 0000001786A30939>,isArray=000003F...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

config.json file:

{
    "mongoUrl": "mongodb://127.0.0.1:27017/gtfs",
    "agencies": [{
        "agency_key": "AT",
        "path": "./gtfs/"
    }],
    "effectiveDate": "December 19, 2016",
    "noServiceSymbol": "",
    "requestStopSymbol": "***",
    "showMap": true,
    "showOnlyTimepoint": false,
    "showStopCity": false,
    "zipOutput": false,
    "verbose": true
}

you can download the GTFS data from here.

partial trip displays broken stop_times

I believe I've seen this before, not sure if an issue has addressed this before.

Problem:

  • Loop route begins and ends with the same stop
  • Most trips during day have full stop order (with two iterations of the first/last stop)
  • however, some trips during the day start halfway through the stop order
  • GTFS-to-HTML prints such trips with the trip END time assigned to the first row of the trip, no stop_times printed for all stops in the middle of the trip, and the trip end time again assigned to the repeated last stop_time

Example:
See this GTFS, and resulting in timetables:
juneau_html_timetables.zip

Route 5 timetable shows problem as described above, with 7:27 printed for first and last stop_time of first trip (the only partial trip for that route).

GTFS-Exchange Not Accepting Uploads

GTFS-Exchange has not been allowing feeds to be submitted recently and seems to be on its way out.

May be beneficial to point people to TransitFeeds.com

Improved Error Reporting

Enhancement request: verbose option for error reporting, help indicate when errors come from gtfs data, especially incorrectly built timetables.txt

No schedules being created when using specific transit feed

Hi again,

I'm experiencing another issue where, after importing the GTFS, no schedules will be generated when using the following transit feed:
https://transitfeeds.com/p/societe-de-transport-de-montreal/39/latest

Could it be because of the 2 warnings?

This is the log I get:

Starting GTFS import for 1 file
stm: Downloading GTFS from http://www.stm.info/sites/default/files/gtfs/gtfs_stm.zip
stm: Download successful
stm: Importing GTFS from C:\Projects_Git\gtfs-to-html\gtfs-downloads/stm-gtfs.zip
stm: Importing - agency.txt - 1 lines imported
stm: Importing - calendar_dates.txt - 147 lines imported
stm: Importing - calendar.txt - No file found
stm: Importing - fare_attributes.txt - 2 lines imported
stm: Importing - fare_rules.txt - 222 lines imported
stm: Importing - feed_info.txt - 1 lines imported
stm: Importing - frequencies.txt - 913 lines imported
stm: Importing - routes.txt - 222 lines imported
stm: Importing - shapes.txt - 197711 lines imported
stm: Importing - stop_times.txt - 5215163 lines imported
stm: Importing - stops.txt - 9190 lines imported
stm: Importing - transfers.txt - No file found
stm: Importing - trips.txt - 134614 lines imported
stm: Post Processing data
stm: Completed GTFS import
Completed GTFS import for 1 file

stm: HTML schedules created at C:\Projects_Git\gtfs-to-html/html\stm
┌────────────────────────────────────────┬────────────────────┐
│ Item                                   │ Count              │
├────────────────────────────────────────┼────────────────────┤
│ Timetable Pages                        │ 0                  │
├────────────────────────────────────────┼────────────────────┤
│ Timetables                             │ 0                  │
├────────────────────────────────────────┼────────────────────┤
│ Calendar Service IDs                   │ 0                  │
├────────────────────────────────────────┼────────────────────┤
│ Routes                                 │ 0                  │
├────────────────────────────────────────┼────────────────────┤
│ Trips                                  │ 0                  │
├────────────────────────────────────────┼────────────────────┤
│ Stops                                  │ 0                  │
└────────────────────────────────────────┴────────────────────┘
stm: HTML schedule generation required 166 seconds
Completed Generating HTML schedules

Everything works fine when using the BART GTFS.

Thank you for your help!

Multi-route timetables

Need: Many agencies publish timetables for a travel corridor that shows multiple routes.

Example multiple route timetables

Proposal: Enable multiple routes in a timetable, using records in timetables.txt similar to below:

timetable_id,route_id,direction_id,start_date,end_date,monday,tuesday,wednesday,thursday,friday,saturday,sunday,route_label,service_notes,direction_label
81,1033,0,20150101,20160116,0,0,0,0,0,1,1,"44",Ending January 16,North
81,1035,0,20150101,20160116,0,0,0,0,0,1,1,"48",Ending January 16,North

Notice the new use of route_label. It may be necessary to look at how timetables are labeled as a whole if they incorporate multiple routes.

Crash during schedule generation

An exception is causing gtfs-to-html to crash with the following output:
Error: No trips found for route_id=12345, direction_id=0, service_ids=["14","10","8","17","13","7","4"], timetable_id=2452_34_0000010_0 at getTripsFromTimetable (/usr/local/lib/node_modules/gtfs-to-html/lib/utils.js:413:11) at <anonymous> at process._tickCallback (internal/process/next_tick.js:160:7)

Process should skip the route if result of gtfs.getTrips(tripQuery) is empty.

Easier-to-read filenames

current form is timetableId_longname_serviceLabel_directionId e.g. 38_NorthernRohnertParkTripper_NewSchoolServiceCalendar_0

Example form which would be easier for humans to distinguish:
timetableId_shortName/longName_directionLabel {some declaration of service days}

Control stop order in timetables

Need: Control stop order manually. This is especially important if #9 (multi-route timetables) is implemented.

Proposal: Add a new file called timetable_stop_order with the following fields:

  • timetable_id
  • stop_id
  • stop_sequence

With multi-route timetables, stop order could not be controlled deliberately using stop_times.stop_sequence.

Win10: gtfs-to-html fails on unexpected token.

Environment

PS C:\Users\jspet> npm -v
3.10.10

Error

PS C:\Users\jspet> gtfs-to-html --configPath .\config-travelsupport.json
C:\Users\jspet\AppData\Roaming\npm\node_modules\gtfs-to-html\bin\gtfs-to-html.js:39
const getConfig = async () => {
                        ^
SyntaxError: Unexpected token (
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:393:7)
    at startup (bootstrap_node.js:150:9)

Config file

{
	"agencies" : [
		{
			"path" : "C:\Users\jspet\Workspace\travelsupport-data\Ex1_PRG-OLO-OSR-KRK"
		},
		{
			"path" : "C:\Users\jspet\Workspace\travelsupport-data\Ex3_PRG-PED-BRQ-Breclav"
		},
		{
			"path" : "C:\Users\jspet\Workspace\travelsupport-data\Ex3_PRG-PED-BRQ-BTS-BUD"
		},
		{
			"path" : "C:\Users\jspet\Workspace\travelsupport-data\Ex3_PRG-PED-BRQ-VIE-GRZ"
		}
	]
}

<div class="table-responsive">

Brendan,
The designer I am working with had a suggestion.
It looks like the outputted table makes use of bootstrap, but tables in bootstrap aren't automatically fully responsive. If the <table> is wrapped in a <div class="table-responsive"> as per http://getbootstrap.com/css/#tables-responsive, this will allow the user to scroll horizontally at small widths.

No trips found?

I need help understanding this error I'm getting because the route_id in question has trips associated with it. There's only one service_id associated with the route in question (7501) so I'm confused why these other service_ids are showing:

$ gtfs-to-html

Starting GTFS import for 1 file
testAgency: Importing GTFS from ./test-feed.zip
testAgency: Importing - agency.txt - 1 lines imported
testAgency: Importing - calendar_dates.txt - 469 lines imported
testAgency: Importing - calendar.txt - 53 lines imported
testAgency: Importing - fare_attributes.txt - No file found
testAgency: Importing - fare_rules.txt - No file found
testAgency: Importing - feed_info.txt - 1 lines imported
testAgency: Importing - frequencies.txt - No file found
testAgency: Importing - routes.txt - 45 lines imported
testAgency: Importing - shapes.txt - 37007 lines imported
testAgency: Importing - stop_times.txt - 88887 lines imported
testAgency: Importing - stops.txt - 696 lines imported
testAgency: Importing - transfers.txt - No file found
testAgency: Importing - trips.txt - 4170 lines imported
testAgency: Importing - timetables.txt - 125 lines imported
testAgency: Importing - timetable_stop_order.txt - 609 lines imported
testAgency: Post Processing data
testAgency: Completed GTFS import
Completed GTFS import for 1 file
testAgency: Generating 56 of 125 HTML schedules
Warning: No trips found for route_id=5222, direction_id=1, service_ids=["1","29510","3810","43310","29803","29503","30303","43303","29502","29602","43202","29501","17601","27201","3701","48001","43001","43101","37001","34301","1101","24701","30701","25201","10"], timetable_id=161
TypeError: Cannot read property 'stoptimes' of undefined
at findCommonStopId (/usr/local/lib/node_modules/gtfs-to-html/lib/utils.js:33:45)
at sortTrips (/usr/local/lib/node_modules/gtfs-to-html/lib/utils.js:96:24)
at getTripsFromTimetable (/usr/local/lib/node_modules/gtfs-to-html/lib/utils.js:539:10)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.