How to effectively display elements on a Google map in the user's viewing range?

When a user moves a Google map, I would like to automatically display items in the user's viewing range. How can I display items efficiently and quickly?

I have a basic understanding of calling the getBounds () method every time the user moves the map, but I'm not sure how I can efficiently search and retrieve elements from my database within the lat / lg borders of the current viewport. Is there a simpler and quick way to do it?

+3
source share
2 answers

. , , .

  • long/lat
  • long lat
  • SELECT * FROM table WHERE long > $long_left AND long < $long_right AND lat > $lat_bottom AND lat < $lat_top

MarkerManager , , .

/ , .

( :-)) , .

+1

Source: https://habr.com/ru/post/1747701/


All Articles