perf(509-1 · 509-3 · 509-6 도엽 등고선 범위 · 화면 밖 건너뜀): 노선 편집 = 노선 띠(저장 노선 bbox + 300 + 여유 300 m)로 자른 도엽 · 배수유역도 = 세부 유역 ∪ 줌아웃 한계 + 300 m 로 따로 자른 도엽(서버 _derived/sheet_<범위> · 사본 지문 + 범위 열쇠) · 띠가 범위 밖인 초안 = 통째 사본 · 미리 받기도 범위본 · 공용 선 그리기 = 같은 쪽 화면 밖 구간 끊음(돌린 화면 = 반 대각선 넓힘) — 요구 317

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-21 20:41:54 +09:00
co-authored by Claude Opus 5.5
parent 23fd2f6f8d
commit 3bc710a636
13 changed files with 1009 additions and 38 deletions
+8 -6
View File
@@ -18,6 +18,8 @@ logger = logging.getLogger(__name__)
router = APIRouter(prefix="/api/projects", tags=["B04 Surface GIS"])
tiles_router = APIRouter(tags=["B04 MVT Tiles"])
from B04_PreProcess.B04_PreProcess_Engine_SheetClip import clipped_sheet # noqa: E402
# 수치지형도 도엽 병합 레이어 (SheetParser 산출과 1:1 — 정의는 SHEET_LAYERS가 유일)
from B04_PreProcess.B04_PreProcess_Engine_SheetParser import SHEET_LAYERS # noqa: E402
@@ -96,12 +98,13 @@ async def get_vworld_map(
# GeoJSON 조회 API
@router.get("/{project_id}/geojson", response_model=None)
async def get_project_geojson(
project_id: UUID, layer: str, request: Request
project_id: UUID, layer: str, request: Request, scope: str | None = None
) -> dict[str, Any] | Response | JSONResponse:
"""저장된 프로젝트의 특정 GeoJSON 레이어 데이터를 반환합니다.
도엽 레이어는 분석용 원본 대신 **표시용 사본**(프로젝트 주변만 잘라 좌표를 줄인 것)을
파일 그대로 내보낸다. 원본을 매번 읽어 재직렬화하면 등고선 한 장에 2초가 든다.
`scope`(route · drainage)를 주면 그 화면이 보는 범위만 자른 사본을 준다(509-1 · 509-6).
"""
pool = get_db_pool()
try:
@@ -153,11 +156,10 @@ async def get_project_geojson(
# 재직렬화만 건너뛰어도 요청당 2초가 사라지고, ETag로 두 번째부터는 304가 된다.
# 다만 **자릿수만 줄인 사본**을 한 번 만들어 그것을 보낸다(2026-09-06) — 형상은
# 그대로고 뜻 없는 자리만 사라진다.
return cached_file_response(
request,
await asyncio.to_thread(_display_copy, filepath),
"application/geo+json",
)
display = await asyncio.to_thread(_display_copy, filepath)
if scope:
display = await asyncio.to_thread(clipped_sheet, project_root, display, scope)
return cached_file_response(request, display, "application/geo+json")
if layer == "등고선":
simplified_filepath = target_dir / "등고선_bounds_simplified.geojson"