Estimated Time of Arrival - Sparragus/ama.js GitHub Wiki

#Estimated Time of Arrival In my opinion, the AMA system is very good. Except for one single thing. You have no idea when a bus will be on the bus stop. You have to stand there and wait...and wait...and wait. And that is the only reason I don't take the bus. I simply can not wait indefinitely for the bus. I also can not estimate how long it will take to go to my destination.

So, how does one estimate time of arrival? This wiki page is dedicated to that. Let's start.

Using Historic Data

Let's consider a certain Bus #26 and a bus rider named Ricky. It is 17:00 of a Monday. Ricky is at the Bus Stop A and he wants to go Bus Stop B. How can we tell Ricky that his bus will be arrive at Bus Stop A in an estimated T minutes?

One method of estimating time is by considering how much time, in previous occasions, it has taken Bus #26 to go from where it is right now to Bus Stop A. In order to do this, it is necessary to keep historic location data.

To keep things simple, let's imagine that this specific database is only keeping location records of Bus #26.

If we know that the Bus #26 is at the coordinates (18.00, -66.00), we could query the database for all the the records in which the bus has been within a 10 meters, for example, range of that location. Since the bus has been there many times (buses loop the same bus route), we need to filter for the occasions where the bus has been there around 17:00.

By now we have a list of Buses #26 that are/have been/will be at (18.00, -66.00) around 17:00. If we take all those records, and see how long it has taken them from there until Bus Stop A, we could average the times, and provide the bus rider with an estimate.

When we filter for a certain time of the day, we are reducing errors due to seasonal effects, like morning or afternoon rush hours. We could reduce seasonal error if we filter further using weather conditions, and day of the week (traffic is lighter on weekends than during the week).

If we were to also provide an Estimated Time of Arrival to the destination, the process would be similar. We would add the ETA from the bus location to Bus Stop A. The estimated time would be added to local time, and a similar time estimation would be performed from Bus Stop A to Bus Stop B.

Using Average Speed

We could use the average speed to estimate the time needed for the bus to arrive at a certain stop. This could be done by averaging the speed from the last N location records.