Merge remote-tracking branch 'origin/sub_laptop_2' into main_laptop_1 — 586-1 GL 바탕 시험 · test_582 같은 줄 양쪽 같음(주석 살림)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
- `GET /api/projects/{id}/plan/terrain/extent` — 받기 전 범위(상자 · 도엽 · 칸 수 · 받은 범위)
|
||||
- `POST …/plan/terrain` — 사업 전체 지형 한 벌 받기(뒤에서 · 누를 때만) · 끝나면 `surface_models` 행
|
||||
- `GET …/plan/progress` — 일의 진행률
|
||||
- `GET …/plan/tile/{z}/{x}/{y}` — 위성 조각 대리(586-1 GL 바탕 시험)
|
||||
- `GET …/plan/layers/sheet?key=` · `…/cadastral` · `…/raster?kind=slope|hillshade|landslide` ·
|
||||
`…/zones` · `…/soils` · `…/bands` · `…/lines?kind=` · `…/zero-order` ·
|
||||
`…/forest-roads`(GET · POST 올리기) · `…/landslide-zones` — 지도 겹
|
||||
@@ -347,3 +348,29 @@ async def plan_layer_landslide_zones(project_id: UUID) -> dict[str, Any]:
|
||||
cadastral = None
|
||||
value = await asyncio.to_thread(landslide_zone.zone_layer, root, cadastral, box, epsg)
|
||||
return {"status": "success", **value}
|
||||
|
||||
|
||||
@router.get("/{project_id}/plan/tile/{z}/{x}/{y}", response_model=None)
|
||||
async def plan_satellite_tile(project_id: UUID, z: int, x: int, y: int) -> Response:
|
||||
"""위성 조각(PLAN 586-1 GL 바탕 시험 · 브이월드 Satellite z6~19) — 키가 화면에 안 새게 대리."""
|
||||
import urllib.request
|
||||
|
||||
from B04_PreProcess.B04_PreProcess_Engine_VWorld import VWORLD_API_KEY
|
||||
|
||||
_ = project_id
|
||||
if not (6 <= z <= 19 and 0 <= x < 2**z and 0 <= y < 2**z):
|
||||
raise HTTPException(status_code=400, detail="조각 번호가 범위를 벗어났습니다.")
|
||||
url = f"http://api.vworld.kr/req/wmts/1.0.0/{VWORLD_API_KEY}/Satellite/{z}/{y}/{x}.jpeg"
|
||||
|
||||
def fetch() -> bytes:
|
||||
request = urllib.request.Request(url, headers={"User-Agent": "Aislo/1.0"})
|
||||
with urllib.request.urlopen(request, timeout=8) as response:
|
||||
return response.read()
|
||||
|
||||
try:
|
||||
tile = await asyncio.to_thread(fetch)
|
||||
except Exception as error: # noqa: BLE001 — 한 조각 빔은 화면을 막을 일이 아님
|
||||
raise HTTPException(status_code=502, detail="위성 조각을 받지 못했습니다.") from error
|
||||
return Response(
|
||||
content=tile, media_type="image/jpeg", headers={"Cache-Control": "private, max-age=86400"}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user