53 lines
1.9 KiB
Python
53 lines
1.9 KiB
Python
import sys
|
|
from pathlib import Path
|
|
import numpy as np
|
|
|
|
# 루트 디렉토리 설정 및 임포트 경로 추가
|
|
root_dir = Path(__file__).resolve().parent.parent
|
|
sys.path.append(str(root_dir))
|
|
|
|
from utils.vworld_downloader import download_vworld_satellite_map
|
|
|
|
def run_download_only():
|
|
print("VWorld 위성 맵 다운로더만 단독 실행합니다...")
|
|
|
|
prj_path = root_dir / "samples" / "step1_scan" / "result.prj"
|
|
output_dir = root_dir / "instance" / "sample"
|
|
npz_path = output_dir / "structured.npz"
|
|
|
|
if not prj_path.exists():
|
|
print(f"오류: {prj_path} 파일이 존재하지 않습니다.")
|
|
return
|
|
|
|
if not npz_path.exists():
|
|
print(f"오류: {npz_path} 파일이 존재하지 않습니다. 파이프라인 구조화를 먼저 수행해야 합니다.")
|
|
return
|
|
|
|
data = np.load(npz_path)
|
|
bounds = {
|
|
"x": [float(data["bounds"][0][0]), float(data["bounds"][0][1])],
|
|
"y": [float(data["bounds"][1][0]), float(data["bounds"][1][1])],
|
|
"z": [float(data["bounds"][2][0]), float(data["bounds"][2][1])],
|
|
}
|
|
|
|
# 3개 타입 지도 각각 단독 다운로드 기동
|
|
layers = [
|
|
{"layer": "Satellite", "ext": "jpeg"},
|
|
{"layer": "Hybrid", "ext": "png"},
|
|
{"layer": "white", "ext": "png"}
|
|
]
|
|
|
|
print(f"대상 좌표 범위: {bounds}")
|
|
for item in layers:
|
|
layer_name = item["layer"]
|
|
ext = item["ext"]
|
|
print(f"\n- [{layer_name}] 다운로드 시작...")
|
|
map_png_path = download_vworld_satellite_map(prj_path, bounds, output_dir, layer_name=layer_name, ext=ext)
|
|
if map_png_path and map_png_path.exists():
|
|
print(f" -> 성공: {map_png_path.name} 저장 완료. (크기: {map_png_path.stat().st_size:,} 바이트)")
|
|
else:
|
|
print(f" -> 오류: {layer_name} 다운로드 실패.")
|
|
|
|
if __name__ == "__main__":
|
|
run_download_only()
|