Skip to content

Commit

Permalink
updated distance calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
Bionic1251 committed Dec 15, 2023
1 parent 455b320 commit 073ef6f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions recommender-back/src/apis/current.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,8 @@ def find_nearest_stations_weather_data(self, poi: PointOfInterest):
while True:
smallest, nearest = float('inf'), ''
for station in weather:
dist = abs(weather[station]['Latitude'] - lat) + abs(
weather[station]['Longitude'] - lon
)
dist = ((weather[station]['Latitude'] - lat)**2 +
(weather[station]['Longitude'] - lon)**2)**0.5
if dist < smallest:
smallest, nearest = dist, station
for key, value in weather[nearest].items():
Expand Down

0 comments on commit 073ef6f

Please sign in to comment.