Hi, we need to display realtime bus locations on a map. It appears that the the realtime bus vehicle positions and trip updates also contain “future” buses - buses with trips in the future.
I have seen two cases for future trips: sometimes you get two buses at the exact location, where one is the currently running bus and one is the planned/future bus; sometimes you get just one future bus (e.g. school buses that are about to pick up children).
For the first case, how do you remove the duplication at the same location? For the second case, it is valid on the map so we want to keep it.
One obvious way is to detect records with duplicated latitude/longitude. But is there a better way?
For instance, at around 5pm today, the following two realtime vehicle position records have the exact same location, one is currently running and one is in the future (where the start-time is 5:41pm). They have the exact same location so two duplicated records on the map, which isn’t nice:
{
"id": "11954_143975992_2440_230_1",
"is_deleted": false,
"trip_update": null,
"vehicle": {
"trip": {
"trip_id": "317950",
"route_id": "2440_230",
"direction_id": 0,
"start_time": "17:41:00",
"start_date": "20170210",
"schedule_relationship": 0
},
"vehicle": {
"id": "11954_143975992_2440_230_1",
"label": "",
"license_plate": ""
},
"position": {
"latitude": -33.83195114135742,
"longitude": 151.23855590820312,
"bearing": 252,
"odometer": 0,
"speed": 2.299999952316284
},
"current_stop_sequence": 0,
"stop_id": "",
"current_status": 2,
"timestamp": 1486708558,
"congestion_level": 0,
"occupancy_status": 1
},
"alert": null
}, {
"id": "11954_143975993_2440_230_1",
"is_deleted": false,
"trip_update": null,
"vehicle": {
"trip": {
"trip_id": "326981",
"route_id": "2440_230",
"direction_id": 0,
"start_time": "16:56:00",
"start_date": "20170210",
"schedule_relationship": 0
},
"vehicle": {
"id": "11954_143975993_2440_230_1",
"label": "",
"license_plate": ""
},
"position": {
"latitude": -33.83195114135742,
"longitude": 151.23855590820312,
"bearing": 252,
"odometer": 0,
"speed": 2.299999952316284
},
"current_stop_sequence": 0,
"stop_id": "",
"current_status": 2,
"timestamp": 1486708558,
"congestion_level": 1,
"occupancy_status": 1
},
"alert": null
}