[hackpgh-discuss] Re: Bus stop API

  • From: Matthew Beckler <matthew@xxxxxxxxxxxx>
  • To: hackpgh-discuss@xxxxxxxxxxxxx
  • Date: Tue, 12 Oct 2010 16:46:08 -0400

I was thinking it would be great to acquire an old bus sign (like from
the top of the front of the bus) to display the next bus to arrive, and
maybe how long until it arrives? I might have a contact with a contact
of some Authority figures, so we'll see what we can find.

This seems like something simple that could be run on the jukebox, and
spit serial out at an arduino or something.

On 10/12/2010 04:33 PM, Matt Mets wrote:
> Awesome! I 'acquired' the bus sign and a pedestrian walk/don't walk
> light for this project. I can put together a simple relay controller to
> drive the sign, and bring it back into the shop. It would probably be
> nice to have a sign that displays which route the current bus is on; I
> also have a loaner flipdot display that could be re-purposed for this.
> Any designs on which computer/embedded thing to run this on? It could
> potentially be a cloud-based service that is polled by a dumb client, in
> a similar manner to the LED sign.
> 
> Loving the multi-layered approach for making these projects :-)
> 
> Cheers,
> Matt
> 
> 
> 
> On 10/12/2010 04:26 PM, Matthew Beckler wrote:
>> I know that someone mentioned that we have a bus stop sign hanging out
>> in the shop, with the grand idea to have it light up or otherwise
>> indicate when a bus is coming soon. I suppose the first step towards
>> that is figuring out how to get that data, so this afternoon I took a
>> snack break and got something working.
>>
>> There is a website called RouteShout that parses the General Transit
>> Feed Spec (GTFS)[0] feed that transit agencies publish so Google can
>> provide transit info on google maps. RouteShout provides an easy and
>> useful web API around that data (http://www.routeshout.com/main/api)
>> that is pretty slick.
>>
>> I registered for an API key, and wrote a chunk of python to do what we
>> need. There is lots of info available, but all we really need to do is
>> to "Get a list of upcoming stops for a specific agency and stop (within
>> next 2 hours)". For my key, the PA, and the HackPGH bus stop on
>> Jumonville at Watson, this is the url to fetch:
>>
>> http://api.routeshout.com/rs.stops.getTimes
>> ?key=361099f484000362836fca4cc320085d
>> &agency=paac
>> &stop=E33040
>>
>> The API call returns a "webpage" that looks something like this,
>> slightly trimmed:
>> {
>>      "response": {
>>              "timezone": "America/New_York",
>>              "times": [
>>                  {
>>                      "type": "scheduled",
>>                      "arrival_time": "03:49 PM",
>>                      "departure_time": "03:49 PM",
>>                      "route_short_name": "71D",
>>                      "route_long_name": "HAMILTON - VIA
>> OAKLAND-SHADYSIDE-5TH AV - OR"
>>                  },
>>                  {
>>                      "type":"scheduled",
>>                      "arrival_time":"03:50 PM",
>>                      "departure_time":"03:50 PM",
>>                      "route_short_name":"71C",
>>                      "route_long_name":"POINT BREEZE - VIA
>> OAKLAND-SHADYSIDE-CENTRE AV - OR"
>>                  },
>>         ...
>>     ]
>>     }
>>     "status": "ok"
>> }
>>
>> I wrote a little bit of python to fetch and parse this data, giving us
>> results like this:
>>
>> matthew@broderick$ ./get_stop_data.py
>> Status: ok
>> Timezone: America/New_York
>> 04:16 PM
>>      71A
>>      NEGLEY - VIA OAKLAND-SHADYSIDE-CENTRE AV - OR
>> 04:17 PM
>>      500
>>      HIGHLAND PK - DOWNTOWN-OAKLAND-ZOO - OA
>> 04:20 PM
>>      71D
>>      HAMILTON - VIA OAKLAND-SHADYSIDE-5TH AV - OR
>>
>> Seems like this is a good first step towards getting some sort of bus
>> alert system going. I'll go ahead and add this information and my script
>> to the wiki.
>>
>> Thanks,
>> Matthew
>>
>> [0] http://code.google.com/transit/spec/transit_feed_specification.html
>>
>>
> 
> 

Other related posts: