Martin Tithonium (tithonium) wrote,
Martin Tithonium
tithonium

An update on that bus routing thing you were so terribly interested in hearing about the first time:

I decided to change my approach to the problem. Google Transit already provides a good mechanism for determining where you should best go to catch a bus 'now' to get to your destination. I took the html-only version of their routing page and ran it thru a cgi script to reformat it to look better on the mobile screen. I then added some more logic around it to let me choose my source and destination quickly (eg, nerdvana to popcap, popcap to nerdvana, spokane p&r to tcs, etc). So, I now can hit a url and quickly determine where I should go to catch a bus if I'm leaving right now, in order to get me where I'm going as soon as possible.

The next step is to add a bit that indicates clearly how long you have to get to the bus stop, or how long you'll end up waiting for the bus. But, Google only knows the schedule, not the actual bus locations. So, I need to tie into the bus tracking data to see where the bus it thinks I'm supposed to catch /is/, and how far delayed it is. its.wa provides an api for accessing the AVL data for a given route (I have the route number from google), and it has an API for getting departure-time data for specific timepoints in metro's routing. There's no easy way to tie the data from the two together, of course, because the latter doesn't provide vehicle IDs. But, I think I can probably avoid needing the AVL data at all. Google tells me what time the bus is supposed to be at the stop, so I look at the departure data for the nearest timepoint and find the one that matches direction and route and has the closest time to what google says, and from that see what the delay is.

If I get around to it, I may see about ways to make it generic so other people can use it too.
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments