Pregunta

We have a Node.js with MySQL.

In the database we store Longitude, Latitude, and the street addresses of all the events (concerts & comedy shows) happening all over the U.S.

Scenario: When a User logs in, based on their current location (Longitude and Latitude), I'd like to provide a list of all the events taking place within their 30 mile radius. What's the best practice to provide such setup with Node.js and MySQL?

Edit

i.e. If I have a database of 10,000 locations (Lat & Lng), what's the best way to calculate which of these locations are in within 30miles radius of a given location.

¿Fue útil?

Solución

Your question is very broad & unspecific. But I provided a very detailed answer as to how to calculate distances with MySQL using POINT & GEOMETRY functions here. More details here on the official MySQL site.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top