sam keen's corner of the web

Accessing Trimet Arrival Times with SMS

I discovered the Portland Trimet API about a month ago and was very inspired by the amount of real-time information available and the ease of accessing it through their web service. One feature of the service is that for a given stop id you can get the arrival times for the buses/trains for that stop. These are not the scheduled times but rather the real-time estimated arrival time based on the known GPS coordinates of the actual vehicles on their routes.
You can get to this data through IVR system by dialing 503-238-RIDE or on the web.

In the mean time, I have also been working with extending existing APIs with additional access such as SMS and XMPP (jabber). So it was natural to take on this trimet service as my first proof of concept.
For SMS access, you simple text “pdxt {stop_id}” to the short code DOTORG (368674)

so for example, for the stop 8334 (Pioneer Square South MAX Station Eastbound), you would text…

pdxt 8334” to DOTORG (368674)

The result is shown below (with the same request through the web for comparison)

pdxt1pdxt2

There is slight differences in the times since it is difficult to coordinate the SMS and web request precisely.

In my trials, response times for SMS were in the 5-10 second range which for me is acceptable.

I’ll next be working on an XMPP (Jabber) wrapper around the service so you will then be able to access the service with an IM client (which many phones now have). XMPP will give the same mobility benefits of SMS but removes the 155 char limit for the returned text allowing for more information to be included in the returned message.

Once I have completed SMS and XMPP around this service, I plan to refactor the technique so it can be easily applied to other services. I will also document the steps I took to integrate with SMS and XMPP. Look for that on google code soon.

1 Comment to Accessing Trimet Arrival Times with SMS

  1. Adron's Gravatar Adron
    September 2, 2008 at 10:12 pm | Permalink

    Very awesome what TriMet is doing in the tech department. A freind of mine and myself had built a page scarper a few years ago to get times on the Jersey (NJT) Transit site and also TRiMet. Then we found them doing this, offering services. It is so much the multiplier of awesome to grab the services vs. page scraping. The later being kind of stupid.

    But I digress, we’ve diverged into many other things but still maintain and interest of how to capitalize and expand the interest of offering information regarding transit. Making it more and more viable for regular persons is up there in the interest list.

    If you get to developing anything and want a fellow cohort to churn some quality code out let me know. I’d be glad to help out if I can.

Leave a Reply

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>