How can we get realtime vehicle position of single vehicle?


#1

hello eveyone,
when i access vehicle position api https://api.transport.nsw.gov.au/v1/gtfs/vehiclepos it returns all the vehicle details of specific vehicle medium(bus ,train etc).

now suppose if i need single vehicle details then how can i filter that ? help me.


#2

Hi @dhamu143

Probably best to use our Trip Planner API rather than the GTFS-r details.

Let us know if that works for you.


#3

in that case , from which API I can get current position of vehicle?


#4

Sorry, you won’t be able to get a single vehicle location using the APIs. For that, you are right in your initial investigations in that you need to use the GTFS-realtime data. However you will need to get all the data and then parse / filter that on your own infrastructure.


#5

i think this real time data gets updated in very less time so it can create problem i think.


#6

Hey @dhamu143 some of the developers ingest the data and provide it for their own apps via an API. Maybe theycan offer you access to their API?


#7

oh , if it is possible then it will be great. :slight_smile:


#8

Do you require the data be matched with what’s returned by the Trip Planner API?


#9

Not sure what you are trying to do exactly, but I suppose you can call the https://…/gtfs/vehiclepos URL initially to get all the vehicles, and loop through all the vehicle to find the one you want. It will give you the vehicle position. I haven’t worked with the Trip Planner so don’t know how or if you need to match it with the Trip Planner API.


#10

To be able to match the Realtime vehicle position feed you need to know the route ID or the trip ID of the journey. From what I have observed the JP API does not provide that. So the only way you can match to get a specific vehicle position is to use the GTFS realtime timetable data and match it that way. If you are trying to track a vehicle as to what trips they have taken over a course of a day, then that is not possible.


#11

is there any perfect solution found for this problem?