diff --git a/.env.example b/.env.example index c9067009..b9cb4c64 100644 --- a/.env.example +++ b/.env.example @@ -52,7 +52,7 @@ SITE_NAME=${SITE_NAME:-"DTM-Drone Tasking Manager"} BASE_URL=${BASE_URL:-http://localhost:8000/api} API_URL_V1=${API_URL_V1:-http://localhost:8000/api} NODE_ODM_URL=${NODE_ODM_URL:-http://odm-api:3000} -COG_URL=${COG_URL:-"http://localhost:9090/api/v1/buckets/dtm-data/objects/download?prefix="} +COG_URL=${COG_URL} ### ODM ### diff --git a/src/backend/app/s3.py b/src/backend/app/s3.py index fb036633..22d83113 100644 --- a/src/backend/app/s3.py +++ b/src/backend/app/s3.py @@ -213,3 +213,21 @@ def get_object_metadata(bucket_name: str, object_name: str): """ client = s3_client() return client.stat_object(bucket_name, object_name) + + +def get_cog_path(bucket_name: str, project_id: str, task_id: str): + """Generate the presigned URL for a COG file in an S3 bucket. + + Args: + bucket_name (str): The name of the S3 bucket. + project_id (str): The unique project identifier. + orthophoto_name (str): The name of the COG file. + + Returns: + str: The presigned URL to access the COG file. + """ + # Construct the S3 path for the COG file + s3_path = f"dtm-data/projects/{project_id}/{task_id}/orthophoto/odm_orthophoto.tif" + + # Get the presigned URL + return get_presigned_url(bucket_name, s3_path)