Open TransitScreen opened 12 years ago
Unfortunately, many agencies who publish their data through the NextBus website prevent their data from being accessed via the NextBus API. All of the above agencies you mention don't allow use of the NextBus API. For example, you can access the PG The Bus predictions through a page on the NextBus site but not via the equivalent API call.
A list of all agencies accessible via API can be found here; note how much smaller this list is than the one of agencies that NextBus publishes through their web interface. An explanation of why this is as written by NextBus' CTO can be found here.
Thanks for the clarification, Andy.
For the DC area, it looks like University of Maryland is still a possibly valuable addition (they run roughly 30 services).
@kurtraschke says there are other ways to obtain NextBus data for some of those agencies, so it's not impossible after all.
It had been the case at one time that the API endpoint at www.nextbus.com (as opposed to webservices.nextbus.com) would return results for all agencies, rather than only those that have the public API enabled, but it looks like that loophole has been closed:
http://www.nextbus.com/service/googleMapXMLFeed?command=routeConfig&a=sf-muni
Quoting Michael Smith from the discussion linked above: "Any chance you get please advocate for freely available data in useful formats so that as many applications as possible can be created".
Rather than resorting to hacking the API/screen-scraping/doing other things that might provoke NextBus, the best approach is to educate and advocate. OpenPlans put together a good one-pager back when they were trying to get the MTA to stop suing developers which is as relevant here as it was in New York:
I convinced Prince George's County to have NextBus add PG The Bus to the public API. It should be live in a couple of days, when Next Bus receives the signed contract. Unfortunately, I don't have the PHP skills to add it to the transit screens.
Colin -- that's great news, thanks! Adding The Bus to TransitScreen is not at the top of my list right now, so I welcome even an untested partial patch in case you or anyone else want to try it. Searching the code for "art" or "circulator" should give you an idea of where changes need to be made.
Once Colin's patch is integrated that leaves the following local agencies with APIs:
University of Maryland Charm City Circulator (Baltimore) Collegetown Shuttle (Baltimore)
The following greater Washington/Baltimore agencies that need to be evangelized. They simply need to be contacted (local residents or students are ideal, but anyone can ask) and encouraged to let NextBus provide a public API:
Fairfax (CUE) George Mason University Towson University University of Baltimore Howard Transit and Connect-a-Ride Johns Hopkins University Loyola University Maryland
George Mason University is actually on the open API list now. You can see the full list here http://webservices.nextbus.com/service/publicXMLFeed?command=agencyList
These include: PG The Bus, University of Maryland, GMU, Fairfax CUE, etc.
A few of these need to be supported with changes in TransitScreen code.
Others need to be asked to provide open API through NextBus.
See the list of local agencies here: https://github.com/MobilityLab/TransitScreen/wiki/Local-Transit-APIs