Here is the scenario that I need to implement:
Assume that I have a database table that contains Latitudes and Longitudes of all the restaurants of my city, say 500 restaurants. Now I am standing somewhere in the city using my app and want to know my nearby restaurants, say within 10 miles radius.
To achieve this, the app must first know my current location (I have done that). Once my location is known, the app needs to put markers on all the restaurants that are within 10 miles (assume only 25 out of the total 500). I do not need to show the markers for those which are farther than that. Now when I click on any marker I will see the InfoWindow and then clicking on it I need to navigate to a new activity and show some details like address, name, phone number (these all come from database) and its distance from my current location.
Now my two questions:
- I need to show markers only within the given radius and not the rest of those. I too don't want to draw a circle on map. Do I have to traverse all locations and see which lie within the radius or is there a faster and more efficient way?
- Can I have the option of getting both straight-line as well as road distances for all my markers?