Skip to content

Commit

Permalink
get dem from s3 when generating flightplan for individual tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
nrjadkry committed Aug 7, 2024
1 parent 5fc07ad commit 48d04fe
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/backend/app/waypoints/waypoint_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from app.projects.project_crud import get_project_by_id
from app.db import database
from app.utils import merge_multipolygon
from app.s3 import get_file_from_bucket
from databases import Database


Expand Down Expand Up @@ -57,10 +58,11 @@ async def get_task_waypoint(
generate_3d,
)
else:
# dem_path = f"/tmp/{dem.filename}"
# with open(dem_path, "wb") as buffer:
# shutil.copyfileobj(dem.file, buffer)

if project.is_terrain_follow:
dem_path = f"/tmp/{uuid.uuid4()}/dem.tif"
get_file_from_bucket(
settings.S3_BUCKET_NAME, f"dem/{project_id}/dem.tif", dem_path
)
output_file = flightplan.generate_flightplan(
features,
altitude,
Expand All @@ -70,7 +72,7 @@ async def get_task_waypoint(
generate_each_points,
generate_3d,
project.is_terrain_follow,
# dem_path if dem else None,
dem_path if project.is_terrain_follow else None,
f"/tmp/{uuid.uuid4()}",
)

Expand Down

0 comments on commit 48d04fe

Please sign in to comment.