[예측] - OpenDrift Python API 서버 및 스크립트 추가 (prediction/opendrift/) - 시뮬레이션 상태 폴링 훅(useSimulationStatus), 로딩 오버레이 추가 - HydrParticleOverlay: deck.gl 기반 입자 궤적 시각화 레이어 - OilSpillView/LeftPanel/RightPanel: 시뮬레이션 실행·결과 표시 UI 개편 - predictionService/predictionRouter: 시뮬레이션 CRUD 및 상태 관리 API - simulation.ts: OpenDrift 연동 엔드포인트 확장 - docs/PREDICTION-GUIDE.md: 예측 기능 개발 가이드 추가 [CCTV/항공방제] - CCTV 오일 감지 GPU 추론 연동 (OilDetectionOverlay, useOilDetection) - CCTV 안전관리 감지 기능 추가 (선박 출입, 침입 감지) - oil_inference_server.py: Python GPU 추론 서버 [관리자] - 관리자 화면 고도화 (사용자/권한/게시판/선박신호 패널) - AdminSidebar, BoardMgmtPanel, VesselSignalPanel 신규 컴포넌트 [기타] - DB: 시뮬레이션 결과, 선박보험 시드(1391건), 역할 정리 마이그레이션 - 팀 워크플로우 v1.6.1 동기화 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
34 lines
1.3 KiB
Python
34 lines
1.3 KiB
Python
import json
|
|
from shapely.geometry import MultiPoint, Point
|
|
|
|
def get_convex_hull_from_json(json_data):
|
|
"""
|
|
JSON 형식의 위경도 데이터로 Convex Hull을 계산합니다.
|
|
|
|
:param json_data: 위경도 데이터가 포함된 JSON 리스트
|
|
:return: Convex Hull의 좌표 리스트 (폴리곤 또는 포인트)
|
|
"""
|
|
# JSON 데이터를 파싱하여 [longitude, latitude] 형태로 변환
|
|
points = [(point["lon"], point["lat"]) for point in json_data]
|
|
|
|
# 중복 제거
|
|
unique_points = list(set(points))
|
|
|
|
if len(unique_points) < 3:
|
|
if len(unique_points) == 1:
|
|
return unique_points # 단일 포인트 반환
|
|
elif len(unique_points) == 2:
|
|
return unique_points + [unique_points[0]] # 두 점은 선분으로 처리
|
|
else:
|
|
raise ValueError("Convex Hull을 계산하려면 최소 3개의 고유한 포인트가 필요합니다.")
|
|
|
|
# MultiPoint로 Convex Hull 계산
|
|
multi_point = MultiPoint(unique_points)
|
|
hull = multi_point.convex_hull
|
|
|
|
# 결과가 폴리곤일 경우 좌표 리스트 반환, 단일 포인트일 경우 포인트 반환
|
|
if isinstance(hull, Point):
|
|
return [list(hull.coords)[0]]
|
|
else:
|
|
# 폴리곤의 외곽 좌표 (폐쇄된 형태로 첫 포인트 반복)
|
|
return list(hull.exterior.coords) |