Answer the question
In order to leave comments, you need to log in
How to calculate distance to coordinates?
There is a table in the database while there id, city_name, there will probably be more coords (string)
There are user coordinates.
It is necessary to find the city closest to the user.
I can’t understand how to calculate and most importantly how best to store the coordinates of the city for this.
It would be possible to get the city by api from google or yandex, but the list of cities is limited, there are 25 cities. Over time, there will be more of course, but not everything is accurate.
What do you advise?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question