Skip to content

Real-time🛰️ vehicle locations/positions 🚌  #80

@mmathieum

Description

@mmathieum

As a user I want to see the vehicle on the map


GTFS-RT > Vehicle Positions

  • Filter:
    • trip: TripDescriptor
      • trip_id: The trip_id from the GTFS feed that this selector refers to.
        For non frequency-based trips, this field is enough to uniquely identify the trip.
        For frequency-based trip, start_time and start_date might also be necessary.
        When schedule_relationship is DUPLICATED within a TripUpdate, the trip_id identifies the trip from static GTFS to be duplicated.
        When schedule_relationship is DUPLICATED within a VehiclePosition, the trip_id identifies the new duplicate trip and must contain the value for the corresponding TripUpdate.TripProperties.trip_id.
      • route_id: The route_id from the GTFS that this selector refers to.
      • direction_id: The direction_id from the GTFS feed trips.txt file, indicating the direction of travel for trips this selector refers to.
      • start_time: HH:MM:SS (if non-frequency-based trip -> omitted/useless) If the trip corresponds to exact_times=1 GTFS record, then start_time must be some multiple (including zero) of headway_secs later than frequencies.txt start_time for the corresponding time period.
      • start_date: YYYYMMDD Must be provided to disambiguate trips that are so late as to collide with a scheduled trip on a next day.
      • schedule_relationship
        • SCHEDULED, ADDED, UNSCHEDULED, CANCELED, REPLACEMENT, DUPLICATED, DELETED, NEW
      • modified_trip
        • modifications_id: The 'id' from the FeedEntity in which the contained TripModifications object affects this trip.
        • affected_trip_id: The trip_id from the GTFS feed that is modified by the modifications_id
        • start_time: The initially scheduled start time of this trip instance, applied to the frequency based modified trip. Same definition as start_time in TripDescriptor.
        • start_date: The start date of this trip instance in YYYYMMDD format, applied to the modified trip. Same definition as start_date in TripDescriptor.
    • vehicle: VehicleDescriptor
      • id: Internal system identification of the vehicle.
      • label: User visible label
      • license_plate: The license plate of the vehicle.
      • wheelchair_accessible
        • NO_VALUE, UNKNOWN. WHEELCHAIR_ACCESSIBLEWHEELCHAIR_INACCESSIBLE`
  • Data:
    • position: Position
      • latitude: Degrees North, in the WGS-84 coordinate system.
      • longitude: Degrees East, in the WGS-84 coordinate system.
      • bearing: Bearing, in degrees, clockwise from North, i.e., 0 is North and 90 is East. This can be the compass bearing, or the direction towards the next stop or intermediate location. This should not be direction deduced from the sequence of previous positions, which can be computed from previous data.
      • odometer: Odometer value, in meters.
      • speed: Momentary speed measured by the vehicle, in meters per second.
    • current_stop_sequence: The stop sequence index of the current stop
    • stop_id: Identifies the current stop. The value must be the same as in stops.txt in the corresponding GTFS feed.
    • current_status: VehicleStopStatus
      • INCOMING_AT. STOPPED_AT, IN_TRANSIT_TO
    • timestamp: Moment at which the vehicle's position was measured. In POSIX time (i.e., number of seconds since January 1st 1970 00:00:00 UTC).
    • congestion_level: CongestionLevel
      • UNKNOWN_CONGESTION_LEVEL, RUNNING_SMOOTHLY, STOP_AND_GO, CONGESTION,SEVERE_CONGESTION
    • occupancy_status: OccupancyStatus
      • EMPTY, MANY_SEATS_AVAILABLE, FEW_SEATS_AVAILABLE, STANDING_ROOM_ONLY, CRUSHED_STANDING_ROOM_ONLY, FULL, NOT_ACCEPTING_PASSENGERS, NO_DATA_AVAILABLE, NOT_BOARDABLE
    • occupancy_percentage: A percentage value indicating the degree of passenger occupancy in the vehicle.
    • multi_carriage_details : CarriageDetails
      • ....
entity {
  id: "1"
  vehicle {
    trip {
      trip_id: "4207020"
      schedule_relationship: SCHEDULED
      route_id: "96"
    }
    position {
      latitude: 43.723236
      longitude: -79.558655
      bearing: 252.0
      speed: 0.0
    }
    timestamp: 1764599039
    vehicle {
      id: "3638"
    }
    occupancy_status: EMPTY
  }
}

NextBus > Vehicle Locations

Maximum timespan for "vehicleLocations" command: 5min

  • Filter: https://retro.umoiq.com/service/publicXMLFeed?command=vehicleLocations
    • a – The agency tag from agencyList command
    • optional r – The route tag from the routeList command (route short name)
    • optional t (msec since 1970 epoch time) – Specifies time of the last update for the
      vehicle location data returned. (else 15 minutes)
  • Data:
    • id: (string) – Identifier of the vehicle. It is often but not always numeric.
    • routeTag (string) - (route short name) Specifies the ID of the route the vehicle is currently associated with.
    • dirTag (string) - (route headsign value) Specifies the ID of the direction that the vehicle is currently on. The
      direction ID is usually the same as a trip pattern ID, but is very different from the
      tripTag. A direction or trip pattern ID specifies the configuration for a trip. It can be used
      multiple times for a block assignment. But a tripTag identifies a particular trip within a
      block assignment.
    • lat/lon – specify the location of the vehicle.
    • secsSinceReport (int) – How many seconds since the GPS location was actually
      recorded. It should be noted that sometimes a GPS report can be several minutes old.
    • predictable (boolean) – Specifies whether the vehicle is currently predictable.
    • heading (int) – Specifies the heading of the vehicle in degrees. Will be a value between 0
      and 360. A negative value indicates that the heading is not currently available.
    • speedKmHr (double) – Specifies GPS based speed of vehicle.
{
  "lastTime":{
    "time": "1764599398962"
  },
  "vehicle":[
    {
      "id": "1214",
      "routeTag": "902S",
      "dirTag": "902S_1_var0",
      "lat": "45.517819",
      "lon": "-73.7006",
      "secsSinceReport": "320",
      "predictable": "true",
      "heading": "130",
      "speedKmHr": "19"
    }
  ]
}
{
  "lastTime":{
    "time": "1764602055358"
  },
  "vehicle":[
    {
      "id": "3638",
      "routeTag": "96",
      "dirTag": "96_0_96A",
      "lat": "43.7250477",
      "lon": "-79.5506269",
      "secsSinceReport": "12",
      "predictable": "true",
      "heading": "72",
      "speedKmHr": "9"
    }
  ]
}

Links:

Testing:

Metadata

Metadata

Assignees

Labels

P2🔼 Priority 2: High

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions