added vegetation

This commit is contained in:
2026-06-23 13:57:33 +03:00
parent 0c9fc22d22
commit c7435955c3
32 changed files with 336 additions and 15 deletions
+11
View File
@@ -1,9 +1,12 @@
from sqlalchemy.orm import Session
from app.config import get_settings
from app.core.diffraction import deygout
from app.core.fresnel import LosSample, los_analysis
from app.core.geo import GeoPoint, sample_path
from app.core.propagation import manual_link_budget
from app.core.raster_sampling import raster_files
from app.models.common import DataSources
from app.models.link import LinkBudgetRequest, LinkBudgetResponse
from app.models.terrain import Obstruction
from app.services.terrain import surface_profile_from_points
@@ -54,6 +57,7 @@ def link_budget(request: LinkBudgetRequest, db: Session | None = None) -> LinkBu
vegetation_db=vegetation_db,
fresnel_clear=los_result.los_clear,
)
settings = get_settings()
geometric_obstructions = [
sample for sample in los_result.obstructions if sample.clearance_m < 0
]
@@ -71,6 +75,13 @@ def link_budget(request: LinkBudgetRequest, db: Session | None = None) -> LinkBu
geometric_obstructions_count=len(geometric_obstructions),
building_obstructions_count=len(building_obstructions),
worst_obstruction=_convert_obstruction(los_result.worst_sample),
data_sources=DataSources(
dem=bool(raster_files(settings.dem_path)),
buildings=request.include_buildings and db is not None,
landcover=request.include_vegetation
and bool(raster_files(settings.landcover_path)),
canopy=False,
),
)