databasecoordinates

Get all coordinates closer than x - how to implement


I have multiple locations with coordinates. I'd like to ask what is the best (fastest) method how to get all points which are closer than, for example, 50km to the particular point.

I made it this way: I saved all coordinates into database, and I'm making a query to get the points. Is this a good solution? Is MySQL suitable for this?


Solution

  • A professional solution would use PostGIS, a "spatial database extender" for PostgreSQL.

    For simple purposes this related answer works with basic Postgres, too: