Skip to content

Commit 136b88b

Browse files
committed
points_gps liste de 2 floats
1 parent b468d9b commit 136b88b

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

app/main.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import gc
66
import os
77
from contextlib import asynccontextmanager
8-
from typing import Dict, List
8+
from typing import Dict, List, Annotated
99

1010
import geopandas as gpd
1111
import mlflow
@@ -93,21 +93,21 @@ def show_welcome_page():
9393

9494
@app.get("/find_image", tags=["Find Image"])
9595
async def find_image(
96-
gps_point: List[float] = Query(..., description="[longitude, latitude] in WGS84"),
96+
gps_point: Annotated[List[float], Query(min_length=2, max_length=2, description="[latitude, longitude] in WGS84")],
9797
nuts_id: str = Query(...),
9898
year: int = Query(2021, ge=2018, le=2024)
9999
) -> str:
100100
"""
101101
Find image path for a given NUTS3 and year.
102102
103103
Args:
104-
gps_point (List[float]): [longitude, latitude] of the GPS point in WGS84.
104+
gps_point (List[float]): [latitude, longitude] of the GPS point in WGS84.
105105
nuts_id (str): The ID of the NUTS.
106106
year (int): The year of the satellite images.
107107
Returns:
108108
str: Image filepath if found, otherwise empty string.
109109
"""
110-
lon_gps, lat_gps = gps_point[0], gps_point[1]
110+
lat_gps, lon_gps = gps_point[0], gps_point[1]
111111
logger.info(f"Find the image filepath for this gps point: {lon_gps}, {lat_gps}")
112112
gc.collect()
113113

0 commit comments

Comments
 (0)