working MPV
This commit is contained in:
@@ -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])
|
||||
|
||||
Reference in New Issue
Block a user