Private
Public Access
1
0

working MPV

This commit is contained in:
Sander Roosendaal
2021-10-08 16:24:58 +02:00
parent b497449846
commit e604350e23
9 changed files with 401 additions and 54 deletions

View File

@@ -63,18 +63,22 @@ def getnearestraces(lat_lon,races,whatisnear=150):
return races
def getnearestcourses(lat_lon,courses,whatisnear=150):
def getnearestcourses(lat_lon,courses,whatisnear=150,strict=False):
print(lat_lon,whatisnear)
newlist = []
counter = 0
for c in courses:
coords = c.coord
distance = howfaris(lat_lon,c)
if distance < whatisnear:
newlist.append(c)
counter += 1
if counter>0:
courses = newlist
elif strict:
courses = newlist
else:
orders = [(c.id,howfaris(lat_lon,c)) for c in courses]
orders = sorted(orders,key = lambda tup:tup[1])