Skip to content

Feature/chart library catalog#24

Merged
beetlebugorg merged 6 commits into
mainfrom
feature/chart-library-catalog
Jun 26, 2026
Merged

Feature/chart library catalog#24
beetlebugorg merged 6 commits into
mainfrom
feature/chart-library-catalog

Conversation

@beetlebugorg

Copy link
Copy Markdown
Owner

No description provided.

beetlebugorg and others added 6 commits June 25, 2026 22:12
Foundation for the chart-library work (parse CATALOG files; show
per-upload chart info). Two self-contained, tested pieces:

- pkg/s57: ParseCatalog/ParseCatalogFS decode an ENC exchange-set
  CATALOG.031 (ISO 8211 CATD records) into per-file entries — long name
  (LFIL), IMPL, coverage bbox (SLAT/WLON/NLAT/ELON), CRC — with helpers
  for base-cell filtering and the union bbox. Decoded positionally from
  the raw CATD field (NOAA/IHO ASCII layout) since the catalogue carries
  no DDR subfield labels. Tested against a real NOAA fixture.

- internal/engine/baker: ExtractCellMeta gathers per-cell metadata
  (compilation scale, edition/update/issue date, producing agency,
  coverage bbox) via the same cheap coverage-only parse the bake's pass 1
  uses, so it adds no full re-parse.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Server-side metadata layer for "one pack per upload, named from CATALOG
identity" (the chosen model). Pure + unit-tested; wires into the import
path next.

- catalogPackIdentity: derive a stable pack key from an exchange set —
  the longest common prefix of cell stems (US5MD1MC/US5MD2NW → "us5md"),
  a single cell → its full stem, no shared prefix → "" (caller falls back
  to the upload filename). slug() keeps it a valid set name.
- buildSetMeta: assemble a pack's SetMeta from baker.ExtractCellMeta
  overlaid with the CATALOG.031 catalogue — catalogue LFIL supplies human
  chart titles and fills coverage bboxes the header lacks; aggregates the
  scale range, producing agency, union bbox, and cell count.
- writeSetMeta/readSetMeta: <pack>.meta.json sidecar beside the archives.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Each uploaded exchange set now becomes its own pack named from its
CATALOG identity, with extracted metadata exposed to the library.

- extractZipCells: stop dropping CATALOG.031 (its ".031" ext otherwise
  looked like an ENC update file) — parse it and return the *s57.Catalog.
- handleImport: set=auto|"" derives a per-upload pack name via the
  CATALOG identity (longest common cell prefix → "user-<id>"), uniquified
  against existing packs; falls back to the cells' prefix then "upload".
- bakeAndRegister: after baking, ExtractCellMeta + buildSetMeta (catalogue
  titles + coverage overlaid) and write the <pack>.meta.json sidecar.
- /api/packs merges title/agency/scale-range/cellCount/imported; new
  GET /api/pack/<name> returns the full per-cell detail. Delete cleans up
  the sidecar.

Verified end to end against a real NOAA upload (US5MD1MC → "user-us5md1mc",
"Annapolis Harbor", 1:12000, NOAA): /api/packs + /api/pack both correct.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Complete the chart-library feature on the client: each upload is its own
pack with the metadata the backend extracts, and the in-browser OPFS cell
store is gone (everything server-side).

- chart-service.mjs: importZip()/importZipAndWait() (whole-zip multipart →
  /api/import?set=auto) and packDetail() (GET /api/pack/<name>).
- chart-library.mjs: drop the OPFS store + the in-browser zip cell-selection
  flow (_archive/_selected/importSelected/renderArchiveList/_refreshCharts).
  A .zip uploads whole (server names + bakes one pack); a lone .000 uploads +
  auto-bakes. User packs render from /api/packs with title/scale/agency/counts
  and a coverage preview; per-cell detail (title/scale/edition/date) loads
  lazily from /api/pack/<name>.
- chart-library.view.mjs: retire archiveList; refresh the import hints.
- chartplotter.mjs: remove ChartStore; seed _installed from /api/cells (via
  _renderInstalledSets); reroute share-restore to bake a "user-shared" server
  pack instead of caching cells in OPFS. Delete the dead chart-store.mjs.

Backend verified end-to-end earlier; the library UI + share-restore want an
in-browser check (make serve). go test ./... + web tests + node --check green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
CATALOG.031 is often absent or omits titles in real uploads, but the
NOAA master index (catalog.json) is a large, separate artifact that must
not become a dependency of the server binary or this feature.

Title resolution is now purely upload-local: CATALOG.031 LFIL when the
exchange set provides it, otherwise no human title — ExtractCellMeta
leaves Title empty (S-57 headers carry only the cell code), and consumers
fall back to the cell Name. All other metadata (scale/edition/date/agency/
coverage) still comes from each cell's own header, so a catalogue-less
upload is fully described regardless. Adds a no-CATALOG test.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
# Conflicts:
#	web/src/plugins/chart-library.mjs
@beetlebugorg beetlebugorg merged commit a9673db into main Jun 26, 2026
4 checks passed
@beetlebugorg beetlebugorg deleted the feature/chart-library-catalog branch June 26, 2026 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant