use estimate_location in via_home.get_location

This commit is contained in:
Sean Breckenridge 2023-02-22 04:56:15 -08:00
parent c9c2415771
commit b7d1012bf5

View file

@ -68,15 +68,9 @@ def get_location(dt: datetime) -> LatLon:
'''
Interpolates the location at dt
'''
if dt.tzinfo is None:
dt = dt.replace(tzinfo=timezone.utc)
hist = list(reversed(config._history))
for pdt, loc in hist:
if dt >= pdt:
return loc
else:
# I guess the most reasonable is to fallback on the first location
return hist[-1][1]
loc = list(estimate_location(dt))
assert len(loc) == 1
return loc[0].lat, loc[0].lon
# TODO: in python3.9, use functools.cached_property instead?