Google Maps API + PHP + Mysql - Best way to look for locations closer to the center of the map

0

Using Google Maps API, PHP, and Mysql, what is the best performance way to query the database, through the coordinates, the locations closest to the center of the map?

At first I thought of Ajax. Each interaction on the map (zoom or change in the center), go to the server by javascript and with a function in PHP query the database and return to the pages the coordinates of the already filtered markers, displaying them. The function that filters these places was done in Mysql itself.

I also thought of the option to bring all the markers at once, and through the API itself display only those closest. I believe that this solution is not the most viable, since with the markers I will bring more information from each location.

Is there any other way, better in terms of performance, to do this? Websocket maybe?

Thank you.

    
asked by anonymous 29.05.2018 / 17:30

0 answers