The problem I'm tackling is as follows:
We have a system with thousands of drivers sending their location data to our back-end services. The problem is given a location
(lat, long)
and aradius
to find which vehicles/drivers are inside the circle.
The obvious and easy answer to this problem is a brute force approach: Take every driver's last location and calculate the distance between the driver's vehicle and the center point, it either resides in the circle or not.
However, I believe this approach is not the most scalable and efficient solution especially when we are talking about thousands of queries like this, the system might get overwhelmed.
So my question is what are some better approaches? are there better algorithms? are there any third-party tools/technologies to help me(such as PostGIS etc)?
Thanks for your attention