NextBus XML Data Feed

From Robertjd

Jump to: navigation, search

Instructions from sfmta.com

SF muni has released instructions on how to use the NextBus XML feed. Their instructions are more complete than mine:

http://www.sfmta.com/cms/asite/nextmunidata.htm


This information is within the context of the San Francisco Municipal Railway feed.

URL format

The base URL is:

http://www.nextmuni.com/s/COM.NextBus.Servlets.XMLFeed?

Possible parameters:

command=

(required) possible values:

  • vehicleLocations
Get a list of vehicle locations. Requires
  • routeConfig
returns stop locations, direction definitions, and route paths
  • predictionsForMultiStops
used to ask for arrival predictions for a stop. stops must be specified with the stops parameter
a=

(required) The agency name of the transit agency. In the case of SF, this is sf-muni

t=

"last time", not sure what this is but I always set it to 0

r=

the route tag of the specific route you want to inquire about

stops=

Used to request one or more stops. the format is an array like so:

route|dirtag|stopid

dirtag can be empty to get all directions for a given route at a given stop. For example:

&stops=38|null|GEARMSI1&stops=38|null|GEARPRE0

will give you all directions of the 38 bus for those two stops. Also note that trying to limit by dirtag doesnt always seem to actually work.

Personal tools