fix: align CM93 coverage and hazard runtime with OpenCPN

This commit is contained in:
OpenAI Codex
2026-09-20 09:28:34 +08:00
parent 3092ff20a3
commit 99fdbdc694
7 changed files with 192 additions and 80 deletions

View File

@@ -383,22 +383,14 @@ def _load_coverage_unions(
_to_mercator_geom(geom)
)
pieces = []
for cell in cells:
cid = int(cell["id"])
if by_cell.get(cid):
pieces.append(unary_union(by_cell[cid]))
continue
minx, miny = lonlat_to_mercator(
float(cell["bbox_min_lon"]),
float(cell["bbox_min_lat"]),
)
maxx, maxy = lonlat_to_mercator(
float(cell["bbox_max_lon"]),
float(cell["bbox_max_lat"]),
)
pieces.append(box(minx, miny, maxx, maxy))
# Keep the independent audit scope identical to OpenCPN/Builder
# coverage semantics: only explicit M_COVR rows define valid coverage.
# Never substitute the chart_cell index bbox for a missing M_COVR.
pieces = [
unary_union(by_cell[cid])
for cid in sorted(by_cell)
if by_cell[cid]
]
if pieces:
result[scale] = unary_union(pieces).intersection(
broad_box_m