#!/usr/bin/env python3 """Build one local NavFrame region archive from an existing Geofabrik extract. Network is not used by this script. Inputs (PBF, matching .poly and Planetiler jar) must be supplied by the operator; output is a deterministic ZIP-compatible .navframe. """ import argparse import hashlib import json import struct from pathlib import Path import re import subprocess import zipfile import shutil ROOT = Path(__file__).resolve().parents[2] POI_BUILDER = ROOT / "tools/offline/build-pois.py" POI_VERSION = "NavFrame POI 1.1.0" RECIPE = "NavFrame regional pack 1.1.0" def sha(path): digest = hashlib.sha256() with path.open("rb") as stream: for block in iter(lambda: stream.read(1024 * 1024), b""): digest.update(block) return digest.hexdigest() def pmtiles_bounds(path): with path.open("rb") as stream: header = stream.read(127) if len(header) != 127 or header[:7] != b"PMTiles" or header[7] != 3: raise ValueError("Map input is not a PMTiles v3 archive") west, south, east, north = struct.unpack_from("