When a user moves the Google map, I would like to display items in the viewing range of the user automatically. How can I efficiently and quickly display the items?
I have basic understanding of calling getBounds() method every time the user moves the map, but I am not sure how I can efficiently search and get from my database the items within the lat/lng of the bounds of the current viewport. Is there easier and faster way of doing this?
In addition to Geek’s answer, you may also want to consider creating an index on a Geohash instead. You could also use a database with spatial indexing capabilities. MySQL, PostgreSQL and SQL Server 2008 all have geo-spatial features (either natively or via extensions), which include spatial indexing.