BlinkTagInc / gtfs-to-html

Build human readable transit timetables as HTML or PDF from GTFS.
https://gtfstohtml.com
MIT License
181 stars 57 forks source link

Unable to create pdf timetables 2.0 #80

Closed turbobenny closed 4 years ago

turbobenny commented 4 years ago

Hallo,

I'm back again. As I already told you, generating html-timetables works. Generating pdf-timetables does still not work.It kills the process with "unable vto connect to browser."

Here'sxwhat it says:

Completed GTFS import for 1 file VBB: Generating PDF timetables [------------------------------------] 0/2903832 Error: TimeoutError: Timed out after 30000 ms while trying to connect to the bro wser! Only Chrome at revision r756035 is guaranteed to work. (node:6620) UnhandledPromiseRejectionWarning: TimeoutError: Timed out after 3000 0 ms while trying to connect to the browser! Only Chrome at revision r756035 is guaranteed to work. at Timeout.onTimeout (C:\Users\Heinz-Jürgen Schücke\AppData\Roaming\npm\node _modules\gtfs-to-html\node_modules\puppeteer\lib\launcher\BrowserRunner.js:200:2 0) at listOnTimeout (internal/timers.js:549:17) at processTimers (internal/timers.js:492:7) (node:6620) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To termina te the node process on unhandled promise rejection, use the CLI flag --unhandle d-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejectio ns_mode). (rejection id: 1) (node:6620) [DEP0018] DeprecationWarning: Unhandled promise rejections are depre cated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I would be grateful for help. Regards

brendannee commented 4 years ago

This looks like an issue with the puppeteer library, which is part of the PDF generation process: https://github.com/puppeteer/puppeteer/issues/4796

PDF generation works on Mac OS X, but since this is relying on running a headless version of Chrome, its success can vary between operating systems. If possible, try it out on OS X or Linux.

turbobenny commented 4 years ago

Hallo, thanks for your answer. I don't have the possibility to work with OS X or Linux, so this direction is closed for me at present. I have got another issue with gtfs-to-html. The gtfs-feed from my ageny VBB is very big. It amounts to generating about 3000000 timetables. While generating the html-timetables, my 8 GB RAM runs full after about 25000 timetables, and thats it. Nothing goes anymore. I have got a 1 TB HDD hard drive, but the generating seems to remain in the node-app in the random access memory (RAM) and being an amateur, I don't see a way to swap the already generated timetables out of the RAM, so that it can continue working unimpended. As I need only one agency out of this big file (Agency_ID 796), I thought about manually reducing the gtfs-files. This did work for ageny_ID and routes files, but not for the remaining files. Do you know a way to isolate one agency out of a big feed? Another possibility I would like to propose, is to create a possibility to specifically request timetables for only one specified route at a time. The program would load down the gtfs as it does, but only generate a timetable when specifically asked for it. I also tried Timetable-Publisher, and this program only loads the gtfs (which is about 3,5 GB) and then you can ask for every timetable to be generated you wish. It does that either as a html-file or a pdf-file as rquested, which you can download after it has been generated. 3.5 GB is manageable for a normal laptop or PC. This is only meant as an example, as the Timetable Publisher has other issues which I don't like, as for example it includes in every weekday timetable normal and weekday holidays as well as construction timetables, which make the weekday timetables unreadable at times. Thank you for hearing me out, and I hope there is a way to manage generating timetables without killing my RAM. Regards

brendannee commented 4 years ago

I don't know any tools that will extract a single agency out of a large GTFS file.

You are right that GTFS-to-HTML won't work on very large gtfs feeds - it needs to be rewritten to be less memory intensive. It is something I have been thinking about doing for a while.

Currently, all rows of all files in GTFS have to be loaded into the database in order to be queried - the loading happens first so it doesn't know which rows it needs until they are all loaded.

Currently, the only possibility for handling large GTFS feeds it to manually extract just the agency and routes you need from all files and create a smaller GTFS file, which is a lot of manual work.