Wacky Offset Values

47 views
Skip to first unread message

Frederick Farah

unread,
Jul 2, 2019, 4:45:29 PM7/2/19
to SEPTAdev
I was under the impression that the Offset_sec value in the TransitView API is the time in seconds since the vehicle's location was last updated. To check this, I logged data for one specific vehicle on the 42 route once per second, and this is an example of what I got over a short period of time:

lat: 39.949432 lng: -75.15233600000001 Offset_sec: 38 Timestamp: 16:43:29.850382
lat: 39.949432 lng: -75.15233600000001 Offset_sec: 13 Timestamp: 16:43:31.405827
lat: 39.949432 lng: -75.15233600000001 Offset_sec: 21 Timestamp: 16:43:32.603631
lat: 39.949432 lng: -75.15233600000001 Offset_sec: 20 Timestamp: 16:43:33.652024
lat: 39.949432 lng: -75.15233600000001 Offset_sec: 21 Timestamp: 16:43:34.703553
lat: 39.949432 lng: -75.15233600000001 Offset_sec: 20 Timestamp: 16:43:35.753127
lat: 39.949432 lng: -75.15233600000001 Offset_sec: 13 Timestamp: 16:43:36.801074
lat: 39.949432 lng: -75.15233600000001 Offset_sec: 26 Timestamp: 16:43:38.334871
lat: 39.949432 lng: -75.15233600000001 Offset_sec: 21 Timestamp: 16:43:41.201037
lat: 39.949432 lng: -75.15233600000001 Offset_sec: 26 Timestamp: 16:43:42.284423
lat: 39.949432 lng: -75.15233600000001 Offset_sec: 21 Timestamp: 16:43:43.333258
lat: 39.949432 lng: -75.15233600000001 Offset_sec: 20 Timestamp: 16:43:44.398771
lat: 39.949432 lng: -75.15233600000001 Offset_sec: 20 Timestamp: 16:43:45.448736
lat: 39.949432 lng: -75.15233600000001 Offset_sec: 33 Timestamp: 16:43:46.500658
lat: 39.949432 lng: -75.15233600000001 Offset_sec: 26 Timestamp: 16:43:47.555616
lat: 39.949432 lng: -75.15233600000001 Offset_sec: 33 Timestamp: 16:43:48.883786
lat: 39.949432 lng: -75.15233600000001 Offset_sec: 33 Timestamp: 16:43:49.937248
lat: 39.949432 lng: -75.15233600000001 Offset_sec: 39 Timestamp: 16:43:51.342079



I would expect offset_sec to go up by approximately 1 every second, and then reset around 0 once the location is updated. Instead, the numbers increase and decrease randomly in a way that isn't consistent with how seconds even work, if you look at the timestamps to the right. 

Is my interpretation of Offset_sec wrong, or is something else weird going on?

Greg Apessos

unread,
Sep 10, 2019, 5:12:55 PM9/10/19
to SEPTAdev
Hello,

   Sorry for the delay.  Your interpretation of the offset_sec is correct.  However, because of the infrastructure in place, the strange jump in offset is a result of the path the request took and where/when the caching took place.  (The buses currently have a 30 second polling cycle and the cache is set to expire after 15 seconds.)  In retrospect, using a timestamp might have been better choice instead of an offset value. 

   We will take a look at this tomorrow and see if we can clean that up.

-Greg
Reply all
Reply to author
Forward
0 new messages