added land
This commit is contained in:
Binary file not shown.
@@ -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,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user