Bugfixing
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import asyncio
|
||||
import sys
|
||||
from sqlalchemy import select
|
||||
|
||||
sys.path.insert(0, "/app/src")
|
||||
from paths import FLIGHT_GPX_TRACK_PATH # noqa
|
||||
from database import async_session, models # noqa
|
||||
@@ -46,13 +45,18 @@ async def add_elevation_to_tracks():
|
||||
|
||||
for flight in flights:
|
||||
gpx_file = f"{FLIGHT_GPX_TRACK_PATH}/{flight.gpx_track_filename}"
|
||||
gpx = GPXParser(gpx_file)
|
||||
try:
|
||||
gpx = GPXParser(gpx_file)
|
||||
except OSError:
|
||||
print(f"ERROR, cannot open {gpx_file=}, skipping")
|
||||
continue
|
||||
|
||||
coordinates = await gpx.get_coordinates()
|
||||
coordinates = await gpx.get_coordinates_all()
|
||||
elevation = await elevation_api.get_elevation_for_points(coordinates)
|
||||
|
||||
gpx_with_elevation = gpx.add_terrain_elevation(elevation)
|
||||
|
||||
output_name = f"terrain_{flight.gpx_track_filename[30:]}"
|
||||
output_name = f"terrain_{flight.gpx_track_filename[-30:]}"
|
||||
gpx.write(gpx_with_elevation, output=f"{FLIGHT_GPX_TRACK_PATH}/{output_name}")
|
||||
await models.Flight.update(
|
||||
db_session=session, obj=flight, data={
|
||||
|
||||
Reference in New Issue
Block a user