Let's say I have an android app that frequently sends current GPS location of the user. If person is driving with bus, I can easily get GPS location of the bus and display it on the map and update it accordingly every 30 seconds.
Let's say that instead of one bus there are 3 buses driving along same route. My problem is to display real time location of every bus on the route. In this case there are X users on every bus all having my android application installed on their phones. Here is the picture that could represent the problem:
As you can see, every mobile application will send GPS location of the user to my server. Server receives and saves data.
Based on the server data I should create a web app that should display map whith position of every bus in real time.
One possible way to do this is to to try to cluster GPS data and based on clusters to conclude where is position of every bus. This approach has few problems:
- This algorithm could be slow if there is lot of data (then I can't update position of every bus every 30 seconds)
- Second problem is that I don't know number of clusters (buses). There might be 2, 3, 4 or N buses
Is there any other better approach to this problem?