We’re trying to make an iOS app that allows users to create geographical points of interest on a map. We are currently evaluating whether we can use Django/MySQL as a backend for the app.
When the app asks our server for ‘points’ we only want to return those that are within 5km of the user. Thus we need some way of storing the latitude & longitude in the database model and then being able to query the database for points near the users co-ordinates.
E.g. in pseudo code:
SELECT Point FROM Database,
WHERE Point IS WITHIN 5KM OF [LATITUDE]-[LONGITUDE]
Can this be done with Django and MySQL?
You can find a VERY good answer to your question here: SQL abs calculation – using latitudes and longitudes – MATH!
Also if you search a bit more, you probably will find another gazilion answers to how to calculate abs using sql.