Loading output library...
Loading output library...

part of a feed

#part-of-a-feed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
entity {
  id: "vehicle"
  vehicle {
    trip {
      trip_id: "6255"
      route_id: "225"
    }
    position {
      latitude: 28.610946655273438
      longitude: 76.980224609375
      speed: 0.0
    }
    timestamp: 1550596773
    vehicle {
      id: "DL1PD0716"
      label: "DL1PD0716"
    }
  }

timestamps:

#timestamps:
NameEpoch dateHuman readable date (GMT)
Download time15505968252019-02-19 17:20:25
Feed timestamp15505968182019-02-19 17:20:18
first vehicle timestamp15505967732019-02-19 17:19:33
last vehicle timestamp15505963642019-02-19 17:12:44

table made using csv to markdown: https://donatstudios.com/CsvToMarkdownTable
use https://epochconverter.com to quickly see what a big number timestamp computes to.

convert to python dict (equivalent to json in js)

#convert-to-python-dict-(equivalent-to-json-in-js)

how it looks when converted to python dict

#how-it-looks-when-converted-to-python-dict
1
2
3
4
5
6
7
8
9
10
{'header': {'gtfsRealtimeVersion': '2.0',
  'incrementality': 'FULL_DATASET',
  'timestamp': '1550596818'},
 'entity': [{'id': 'vehicle',
   'vehicle': {'trip': {'tripId': '6255', 'routeId': '225'},
    'position': {'latitude': 28.610946655273438,
     'longitude': 76.980224609375,
     'speed': 0.0},
    'timestamp': '1550596773',
    'vehicle': {'id': 'DL1PD0716', 'label': 'DL1PD0716'}}},

Note: some variables change their names from gtfs feed "string" to dict.

  • trip_id > tripId
  • route_id > routeId

size comparison:

#size-comparison:

Stored the full json output to a .json file (manually.. commands changed now).
vehicle_1550596825.pb : 60 KiB
vehicle_1550596825.json : 345.1 KiB

convert to pandas dataframe

#convert-to-pandas-dataframe
Loading output library...
Loading output library...

check out one of the vehicles supposedly repeating:

#check-out-one-of-the-vehicles-supposedly-repeating:
Loading output library...
Loading output library...
Loading output library...
Loading output library...
Loading output library...

Summary

#Summary

While there's 800 to 900 vehicle entities in the feed, around a 100 of them may be duplicate entries. So data of 700 to 800 buses on road is there, and this feed is from around 11pm.

Time related:

  • The feed comes with a feed timestamp.
  • But the timestamps of individual entities can be older
  • While the oldest entry is 34 mins old (2036s), the median is about 1 min.
  • Latest is 29s.
  • Even 75%-median is 1.5 mins.
  • We have an indication that there's repeating entries of the same vehicles, that may account for some of the early entries.
  • But most of the feed seems fairly up-to-date, with median last known position of a vehicle being just 1 min in the past.