First I want to shw you the current database structure. There are three tables:
dishes (id, name)
locations (id, name, coordinates (POINT))
dish_location(location_id, dish_id)
Now I want to implement an API which gets the position (latitude, longitude) of the user and returns a list of dishes sorted by the distance in km. I already have a method which takes two latitudes and two longitudes and gives me the distance. But I am sure you can show me a way, which is a more performant way to do this directly in the MySQL query.
Additional: I want to do a "load more"-function in the API. So I pass the count of already received items or how would I solve this in this case?
I am using this for the MySQL Spatial: http://ift.tt/2gCRw3H
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire