I am currently trying to implement a calculation for a radius:
I have a DB with rooms, every single room has a different adress and also a latiude and longitude.
A user can enter a cityname in a searchform to search for rooms in this city. Here I want to show a result page with rooms in the searched city + all rooms in other cities in a 60 km radius from the searched city.
Here I found some solutions which I would like to try, but I cant figure out how to translate this into an SQLalchemy query:
SELECT * FROM Places WHERE acos(sin(1.3963) * sin(Lat) + cos(1.3963) * cos(Lat) * cos(Lon - (-0.6981))) * 6371 <= 60;
So theoretically I have to replace 1.3963
and -0.6981
with the latitude and longitude of the searched city and I will get what I want.