[hackpgh-discuss] Re: Bus stop API

  • From: Matt Stultz <matt@xxxxxxxxxxxxxxxxxx>
  • To: hackpgh-discuss@xxxxxxxxxxxxx
  • Date: Tue, 12 Oct 2010 16:57:52 -0400

The routeshout thing is actually done by a local company called DeepLocal.
We have had these guys come in to the shop to talk about one of their other
products that is a spin off of routeshout called gumbands. I'm sure they
would love to see this once we have it up and running. They also explained
why it's only schedules and not real time as Derrick pointed out.

Thanks,
Matt

On Tue, Oct 12, 2010 at 4:54 PM, Matt Mets <mahto@xxxxxxxxxxxxx> wrote:

> The flipdot display I have is probably a pull from an old bus, so we could
> probably start with that (
> http://www.flickr.com/photos/cibomahto/4549394144/). It is technically on
> loan, though, so a replacement is probably a good idea :-)
>
> Cheers,
> Matt
>
>
> On 10/12/2010 04:46 PM, Matthew Beckler wrote:
>
>> 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: