您请求访问的页面目前没有您的语言版本。您可以从页面底部选择其他语言,或使用 Google Chrome 的内置翻译功能将网页内容即时翻译成您选择的语言。

Provide Realtime trip information with VehiclePosition

Important: To provide Realtime trip information with VehiclePosition feeds, refer to Select a trip with TripDescriptor.

You can use VehiclePosition feeds to provide Realtime trip information about the status of a transit vehicle on a particular trip.

Get vehicle status updates

A vehicle_position message can provide information about the current status of the vehicle on a particular trip.

For vehicles that are assigned to a trip: Provide a VehiclePositions feed with a well-matched TripDescriptor, accurate position information, and a timestamp at which the position was measured.

VehiclePosition for arrival time

You can use a VehiclePosition message when you provide: 

  • The vehicle’s most updated position with the timestamp of the reading
  • The trip descriptor
  • The vehicle descriptor

For every subsequent stop, we use a prediction algorithm to forecast the ETA of the bus at that stop, given its current position. This information is displayed to the user in the app and also affects the search results.

If the latest vehicle position and other information isn't available, the last-known position and other data should be provided with the original position timestamp measured. Learn more about how data gaps affect realtime feeds.

VehicleDescriptor is necessary to track a trip’s vehicle over time. It should be unique for each feed, and stable during the trip duration. To ensure that the vehicle is trackable, provide the vehicle descriptor id.

Example code:

vehicle_position {
    trip {
      route_id: "route1"
      direction_id: "0"
      start_time: "10:10:00"
      start_date: "20160203"
 
    }
    vehicle {
      id: "route1-v1"
    }
    position {
      latitude: 4066265190
      longitude: 3862204692
    }
    timestamp: 1458508943
  }
}

For fixed schedules, the actual delay is displayed:

  

For frequency based schedules, the arrival time for the next trip displayed without any delay information.

Provide occupancy information

Use the occupancy_status field along with the position of the vehicle_position message. This will appear in the UI as a graphic indicator.

Example code:

vehicle {
  trip {
    trip_id: xxx
    start_time: 12:34:56
    ... 
    occupancy_status: CRUSHED_STANDING_ROOM_ONLY
  }
}

Learn how to provide vehicle occupancy data with GTFS.

Show Realtime vehicle position on Google Maps

Updates that come through the VehiclePosition feed display the Realtime position of vehicles on Google Maps.

Need more help?

Try these next steps:

Search
Clear search
Close search
Main menu
4025218504686764201
true
Search Help Center
true
true
true
true
true
82656
false
false