Open barbeau opened 9 years ago
In Puget Sound, it looks like this may depend on the agency, based on a quick look at the data.
For Metro Transit, lastLocationUpdateTime
is 0
:
http://api.pugetsound.onebusaway.org/api/where/trips-for-route/1_100223.json?includeStatus=true&key=TEST
Here's the GTFS-rt for Metro output from OBA: http://api.pugetsound.onebusaway.org/api/gtfs_realtime/vehicle-positions-for-agency/1.pbtext?key=TEST
entity {
id: "1"
vehicle {
position {
latitude: 47.757553
longitude: -122.24443
}
timestamp: 1445993103
vehicle {
id: "6823"
}
}
}
But for Pierce Transit, lastLocationUpdateTime
is populated:
http://api.pugetsound.onebusaway.org/api/where/trips-for-route/3_2.json?includeStatus=true&key=TEST
Here's the GTFS-rt for Pierce Transit output from OBA: http://api.pugetsound.onebusaway.org/api/gtfs_realtime/vehicle-positions-for-agency/3.pbtext?key=TEST
entity {
id: "1"
vehicle {
trip {
trip_id: "6156535"
route_id: "57"
}
position {
latitude: 47.21401
longitude: -122.46944
}
timestamp: 1446039499
vehicle {
id: "244"
}
}
}
We'll need to dig into the code, as both GTFS-rt outputs do include timestamps for vehicle positions. But, OBA could be populating this field internally - it doesn't necessarily match the data coming into OBA for each agency.
Pierce Transit updates come via OrbCAD integration, not via GTFS-RT as KCM does.
I'm trying this commit out now in the WMATA dev environment. I think its what you are looking for:
@sheldonabrown Thanks for taking a shot at this! So if I'm reading this right, by design this change wouldn't have any impact on the HART data, because HART's GTFS-rt feed doesn't have a timestamp per vehicle position or per trip update, right?
http://realtime.prod.obahart.org:8088/trip-updates?debug http://realtime.prod.obahart.org:8088/vehicle-positions?debug
Who created that GTFS-realtime feed anyway ;)?
IIRC, in the underlying OrbCAD database view a timestamp record per vehicle update wasn't given to us, although one probably exists somewhere in the database. Would require a change to the view and the GTFS-realtime export code to expose it.
A very astute observation. I saw the timestamp in the snippet above but only assumed it was relative to the vehicle and not the entire feed. So yes, more work is required here....
I think that commit is still useful to deploy as is though, right? And if (hopefully when) per vehicle timestamp is added to HART or other feeds it would automatically pick it up?
Yes agreed. I'll keep the commit for when the data is there.
I'm working on showing real-time vehicle positions in OBA Android (https://github.com/OneBusAway/onebusaway-android/issues/176#issuecomment-148847977), using the trips-for-route API - for example:
http://api.tampa.onebusaway.org/api/where/trips-for-route/Hillsborough%20Area%20Regional%20Transit_5.json?key=TEST&includeStatus=true
I want to include the age of the location data in the marker balloons - however, the
lastLocationUpdateTime
field that should have this info is always0
- for example:For now, I'm using
lastUpdateTime
instead as a workaround.Here are the source GTFS-rt feeds for HART: http://realtime.prod.obahart.org:8088/trip-updates?debug http://realtime.prod.obahart.org:8088/vehicle-positions?debug
I haven't had a chance to look into this yet, but I wanted to capture the information here for review later. The GTFS-rt feeds don't have timestamps in the vehicle position entities themselves - only the feed itself has a timestamp, which could be why the
lastLocationUpdateTime
isn't being populated. If that's the case, you could potentially argue that this is working as intended. At any rate, just wanted to document this behavior so we know why its doing this.