Reputation: 3
I'm developing map with lots of markers using Google Maps API and also using auto complete search textbox for place search. Now I want to show the markes only upto particular radius from the searched source place like Mumbai.I need to hide the remaining markers which are all apart from that particular radius from Mumbai.
Thanks in advance. Regards, A.Sundar
Upvotes: 0
Views: 168
Reputation: 582
You could calculate the radius for each marker
if (computeDistanceBetween(map.getCenter(), marker.getPostion()) > RADIUS) {
marker.setVisible(false);
}
Or, do that on the back end if you have a lot of markers to iterate through. You can use the Haversine formula, or a search engine like Solr will do that out of the box.
Upvotes: 1