I have some objects that are geolocalized (I have latitude + longitude for each object). My application should display objects located at a distance of 3 kilometers from the GPS position of the mobile device. I have several thousand objects, and they are localized in a large area (for example, several US states, several small countries), which means in my list of objects that I can place in New York and the other in Miami, but I also have there may be objects that are very close (several meters).
My application is currently doing an iterative search. For each object, I calculate the distance with the GPS position, and if the distance is <= 3KM, I keep the object different, I ignore it. This algorithm is not very efficient, and I am looking for an Algorithm that will give better performance.
I assume that there is a way to sort my objects using geocoordination and find nearby objects located around the GPS position faster.
My current idea is to simply calculate the โextreme pointsโ rectangle, North / South / East / West (from 3 km from the GPS position), to limit the search area. Then I will calculate the distance only for the objects inside this window. I think something better can be done, but I don't have this idea ...
Any suggestion would be appreciated ;-) Thank you,
Seb.
source share