The NextBus public API supports “short titles” for routes and stops, which are designed to be formatted for display on mobile devices, and other environments where space is at a premium. Stop and route definitions in the XML returned by the API both contain a
title attribute with the full title, and a
shortTitle attribute with the short title, if one exists. Unfortunately, there seems to be a bug in the output returned by NextBus which limits the usefulness of this feature.
Here’s an example stop definition (from the
routeConfig call), for the DC Circulator:
<stop tag="masscolu" title="Mass Ave And Columbus Circle" lat="38.8963969" lon="-77.0051865"/>
shortTitle attribute, so there’s no short title, right? Wrong.
Here’s what we get when we request predictions for that stop:
<predictions agencyTitle="DC Circulator" routeTitle="Union Station-Navy Yard via Capitol Hill " routeTag="blue" stopTitle="Mass Ave And Columbus Circle" stopTag="masscolu" dirTitleBecauseNoPredictions="Southbound">
This is precisely as expected. But suppose we add
useShortTitles=true to the query?
<predictions agencyTitle="DC Circulator" routeTitle="Capitol Hill" routeTag="blue" stopTitle="Mass & Columbus Circle" stopTag="masscolu" dirTitleBecauseNoPredictions="Southbound">
Now there’s a short title for the stop! That’s not how it’s supposed to work!
I haven’t investigated this issue very throughly; while I know it exists with the DC Circulator data, I’m not sure if it’s also a problem for other NextBus agencies. Of course, there’s a simple workaround: to get short titles for stops, after calling
routeConfig to get the stops, get predictions for each stop with
useShortTitles=true set, in order to get the stop’s short title. But that’s a silly, time-consuming workaround, and it really shouldn’t be necessary.