1

If you click here and goto the Search page in AirBnb, you will see that if you zoom in or zoom out the map on the right side of the page, The search results are updated based on the area that is displayed on the map.

I find this an amazing feature. But, I have no idea how they are doing it. Can anyone throw some light on how it can be done?

Parthapratim Neog
  • 4,352
  • 6
  • 43
  • 79
  • they probably have event listeners for when the map zoom changes. And when that happens, they then most likely are doing an AJAX request to get properties within the currently visible bounds. Server-side it's probably doing a location-based SQL query to get those properties. Which bit are you needing light thrown on? – duncan Oct 19 '15 at 07:25
  • Yes, I understand that, but the thing I don't understand is How do they know the Exact distance rectangle(or radius) within which they are limiting the search results?? I hope u can understand my query – Parthapratim Neog Oct 19 '15 at 07:30
  • Does Google maps api have a service for that?? – Parthapratim Neog Oct 19 '15 at 07:31
  • They have the Geometry library, which has functions like computeLength and computeArea. See https://developers.google.com/maps/documentation/javascript/reference#spherical – duncan Oct 19 '15 at 11:55
  • Awesome. Thanks. So, if I were to recreate something like this, I need to study the JavaScript API of Google Maps?? Also, I believe the overlays that they are showing there can also be done via. this, Am i right?? @duncan – Parthapratim Neog Oct 19 '15 at 14:55
  • @duncan Can you kindly look into this problem that I am in http://stackoverflow.com/questions/33493334/display-markers-which-are-within-the-current-view-port-in-google-maps-v3-js-api – Parthapratim Neog Nov 03 '15 at 07:27

0 Answers0