Although the route data and geodata in this API is probably not usable in OpenStreetMap -- and isn't necessarily accurate enough to be of much use anyway -- integrations between OpenStreetMap-based applications and the real-time arrival predictions can be made possible by adding a small amount of metadata to the route_master, route and stop objects already present in the OpenStreetMap database.
Here's a suggested tagging scheme for the objects that describe the services of a NextBus-enabled transit agency:
- For route_master relations and route relations, set the nextbus:agency=* tag to be the code representing the agency the object relates to. This will be given as part of a given agency's API documentation, or it can be found in the URL query string of most NextBus UI pages as the "a" parameter. Examples are "sf-muni" and "actransit".
- For route_master relations, set the nextbus:route=* tag to be the route code used for this route by the relevant agency. The set of possible route codes for a given agency is available via the API, or you can find it via the accessible NextBus site by navigating to the route in question and looking at the "r" URL query string argument.
- For route relations representing directions/variants of a route, set the nextbus:dir=* tag to be the direction tag used for the route by the relevant agency. Again these can be found either via the API or in the query strings of the accessible NextBus site, as the "d" argument.
- For objects representing bus stops things are more tricky because agencies often share physical stops and each agency issues its own stopid. For this case, create a tag of the form "nextbus:agency:stopid", where agency is the agency code as used for the nextbus:agency=* tag on a corresponding route. NextBus stopids are actually public-facing and are often either painted on the street or printed on a bus shelter so that users can easily access predictions via mobile devices; for agencies that use stopids (which isn't all of them, sadly) you can find the stopid after the stop name on the predictions on the accessible NextBus site. For example, see this random San Francisco bus stop which has a stopid of 16932).
These tags are intentionally specific to the NextBus system and are not applicable to public transit systems that do not use NextBus. Also, the above is a de-facto convention invented to use for an app relating to San Francisco's Muni system and is not actually any sort of approved tagging scheme... it's documented here only in the hope that if someone else also finds a need to link NextBus data with OSM data they might use a compatible convention.