|Real Time API Feeds
Metro’s Realtime Application Programming Interface (API) gives you access to the positions of Metro vehicles in real time as they travel their routes.
The Realtime API is a RESTful web service designed to serve bus location data gathered by our Advanced Transportation Management System (ATMS) and the Nextrip prediction engine. This is the result of years of hard work refining the information we collect from the GPS trackers on every bus as they serve 1,433 square miles across Los Angeles
Sometimes that data arrives too late to give us useful information. Whenever the buses travel into a radio shadow we need to make a prediction about the location of the bus. This is where Nextrip comes into play.
Metro’s Nextrip service is informed by NextBus, which maintains a publicly accessible XML feed. Use the following information to use NextBus data:
The interface gives your program access to collections and elements. Collections retrieve lists of element URIs. Element URIs retrieve a representation of the element. Only HTTP GET operations are allowed.
The API delivers three different flavors of data: XML, JSON, and JSONP. This table lists the formats and their MIME types.
|text/xml||XML is an encoded document format with arbitrary structure best consumed by machines.|
The interface is divided into four collections: Agency, Routes, Stops, and Vehicles. Each collection returns a list of elements. The element IDs tacitly suggest the URL for the element.
|agencies||lametro is the only available Agency element for now. Agency ID is case-sensitive, and should be all lower-cased.|
|routes||A list of routes available at the agency.|
|stops||A list of stops served by the route.|
|vehicles||A list of the current position of all vehicles belonging to the agency.|
Consider these examples. The first retrieves a collection of routes operated by agency LA Metro. The second retrieves predictions for element stop 6033 . These links open in a new browser window. Go ahead and try them!
Copyright © 2017-2020 Metro | For everyone who wants to make transit better!