added land

This commit is contained in:
2026-06-23 13:04:24 +03:00
parent b92bb1ceba
commit 11a172ef3d
7 changed files with 404 additions and 8 deletions
+31 -3
View File
@@ -1,7 +1,35 @@
from app.models.landcover import LandcoverPathRequest, LandcoverPathResponse
from app.config import get_settings
from app.core.geo import GeoPoint, sample_path
from app.core.landcover import LandcoverNotConfiguredError, landcover_path
from app.models.landcover import LandcoverPathRequest, LandcoverPathResponse, LandcoverSegment
def path_landcover(request: LandcoverPathRequest) -> LandcoverPathResponse:
raise NotImplementedError(
"Landcover and canopy raster sampling is implemented in a later stage"
settings = get_settings()
points = sample_path(
GeoPoint(lat=request.start.lat, lon=request.start.lon),
GeoPoint(lat=request.end.lat, lon=request.end.lon),
request.samples,
)
try:
result = landcover_path(
points,
landcover_path_dir=settings.landcover_path,
canopy_path_dir=settings.canopy_path,
)
except LandcoverNotConfiguredError as exc:
raise NotImplementedError(str(exc)) from exc
return LandcoverPathResponse(
segments=[
LandcoverSegment(
from_m=segment.from_m,
to_m=segment.to_m,
class_name=segment.class_name,
forest_type=segment.forest_type,
canopy_height_m=segment.canopy_height_m,
)
for segment in result.segments
],
vegetation_depth_m=result.vegetation_depth_m,
)