The Amtrak-Related Code

Here’s the post about the three programs I mentioned the other day about Amtrak timetables and on-time performance.  They’re programs I wrote mostly for myself to use, not to create pretty output, but to be quick and dirty ways to get me information for planning trips.

All are pretty clunky.  You first have to load raw data from the Web into your browser, then save the data in a file on your machine, then use that file as the input to a program that you run from a command line.

Most folks reading this blog probably aren’t programmers; so if they’re interested in this at all, they probably don’t want to have to compile the code for themselves.  I’ve compiled them for both Linux and Windows; the Linux version should run on a Mac.

The timetable generator

Before you worry about my code at all, check out Christopher Juckins’ timetables.  He has both current and historical timetables that are pretty PDF files of the sort that Amtrak used to publish and might be much more to your liking.

My code generates timetables that look like (but bigger):

29-30 timetable


2150 timetable

One advantage is that you can create timetables with different trains for each leg of a round trip:

321-302 timetable

but that takes a bit more work on your part.  Also with a bit more work, you can create timetables for trains 421 & 422, the Texas Eagle through cars to Los Angeles, and for the Portland section of the Empire Builder or the Boston section of the Lake Shore Limited, where Dixieland Software doesn’t provide the raw data in a single file.

The documentation is here; the open-source code, if you want to play with it, is here.

If you want to just run the program, the two executables are here.  The file without any extension on the filename is for Linux; the one that ends in “.exe” is for Windows.  Just unzip the one that you want and stick it in some directory on your hard drive that’s in your PATH environment variable; then in the documentation, click on “Instructions for use” in the table of contents.

The raw data for this comes from Dixieland Software.  If you’re only creating one or two timetables, it’s probably easier to just type the URL in your browser; if you might want to generate timetables for lots of trains, I’ve put my little HTML form at so that you can just load that once into your browser and bookmark it.  (Dixieland Software uses just HTTP, not HTTPS, but you’re not transmitting any secrets, so I wouldn’t worry about it.)

Two on-time performance analyzers

This is actually a library that generates an HTML table showing minimum, maximum, median, mean and standard deviation of late times for particular trains at particular stations, or the likelihood of making connections between two trains.  (This is what finally goosed me to write the trivial statistics library that I mentioned in the previous post.)  The two programs I’m talking about here are extra added attractions.

The documentation is here.  If you’re a programmer who wants to play with the open-source code, there’s a link to a zip archive in the introduction.

Most of the documentation is geeky programming stuff; so if you just want to run the programs, go straight to “Two Programs that Use the Library” in the table of contents.  You’ll find links to the executables there.

A simple SQL database

Here are some musings about a possible design for an Amtrak-related database.  Although this is intended for testing the database access library that I’m working on, I’ll include it here because it’s about Amtrak.

My current design is here.

If anybody can think of anything else I should add to it, I’d love to hear about it; although it’s not about making reservations and shouldn’t have any PII in it.

Also, I currently have no clue where to get the data to load the consists table.  If anybody knows where I might find that on the Web, please let me know.  If it’s a secret that you don’t want to disclose in a comment, you can contact me privately at

Leave a Reply

Your email address will not be published. Required fields are marked *