diff --git a/README.md b/README.md index 742cce5..97a91ca 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@
- ⚓ An S-57/S-101 chart engine: vector tiles, S-52 styles, PNG and PDF.
- tile57 turns IHO S-57 ENC cells into vector tiles (MLT or MVT) with a matching MapLibre
- S-52 style, or renders finished charts directly to PNG and PDF — one Zig library with a
- C ABI, compiled natively or to WASM.
+ ⚓ An S-101 / S-57 chart engine: vector tiles, S-52 styles, PNG and PDF.
+ tile57 reads native IHO S-101 ENC charts — and legacy S-57 cells — and turns
+ them into vector tiles (MLT or MVT) with a matching MapLibre S-52 style, or renders finished
+ charts directly to PNG and PDF — one Zig library with a C ABI, compiled natively or to WASM.
@@ -32,9 +32,9 @@ entirely with AI assistance. A few specific goals shape its design:
Claude and reviewed by a human. The project tests how far AI can carry the heavy lifting of
spec interpretation, test coverage, and implementation correctness on a non-trivial domain.
-- **Spec adherence first.** The goal is to implement S-57 decoding, S-101 portrayal, and S-52
- display as faithfully as possible, using the actual IHO spec documents and the official
- Portrayal Catalogue — not approximations or shortcuts.
+- **Spec adherence first.** The goal is to implement native S-101 and S-57 decoding, S-101
+ portrayal, and S-52 display as faithfully as possible, using the actual IHO spec documents
+ and the official Portrayal Catalogue — not approximations or shortcuts.
- **Cross-platform via Zig.** Zig's build system and cross-compilation support let the same
core compile to native (Linux, macOS, Windows) and **WASM** without code changes. Go and Zig
@@ -59,14 +59,17 @@ entirely with AI assistance. A few specific goals shape its design:
---
-**tile57** decodes NOAA/IHO **S-57** ENC cells and generates **vector tiles** by
-`(z, x, y)` — MapLibre Tiles (MLT, the default; MapLibre GL JS ≥ 5.12
-decodes them natively) or Mapbox Vector Tiles — running the
-official IHO **S-101 Portrayal Catalogue** in embedded Lua to produce S-52
-nautical portrayal. Alongside the tiles it emits a **MapLibre GL style** and the
-portrayal **assets** it references — colour tables, line styles, and the sprite
-+ area-fill pattern atlases — so a renderer like
-[MapLibre](https://github.com/maplibre/maplibre-native) can draw a chart directly.
+**tile57** reads native IHO **S-101** ENC charts (S-100 Part 10a) *and* legacy
+NOAA/IHO **S-57** ENC cells — the format is detected from the `.000` file itself —
+and generates **vector tiles** by `(z, x, y)`: MapLibre Tiles (MLT, the default;
+MapLibre GL JS ≥ 5.12 decodes them natively) or Mapbox Vector Tiles. A native
+S-101 dataset feeds the portrayal engine directly; an S-57 cell is converted to
+the S-101 model first. Either way, the official IHO **S-101 Portrayal Catalogue**
+runs in embedded Lua to produce S-52 nautical portrayal. Alongside the tiles it
+emits a **MapLibre GL style** and the portrayal **assets** it references — colour
+tables, line styles, and the sprite + area-fill pattern atlases — so a renderer
+like [MapLibre](https://github.com/maplibre/maplibre-native) can draw a chart
+directly.
It holds only its working set:
@@ -83,13 +86,18 @@ It holds only its working set:
## Pipeline
+Both source formats converge on the same S-101 feature records — a native S-101
+dataset produces them directly; an S-57 cell is adapted into them:
+
```
-S-57 ENC cell (.000)
- │ ISO 8211 decode src/iso8211/
- ▼
-S-57 feature + geometry model src/s57/
- │ adapt S-57 → S-101 features src/s101/ (adapter)
- ▼
+S-101 ENC (.000) S-57 ENC cell (.000)
+ │ ISO 8211 decode │ ISO 8211 decode src/iso8211/
+ ▼ ▼
+S-100 spatial + feature S-57 feature + geometry src/s57/ · src/s101/
+ records model
+ │ assemble to S-101 │ adapt S-57 → S-101 (native.zig / adapter.zig)
+ └──────────────┬──────────────┘
+ ▼
S-101 feature records
│ S-101 portrayal (embedded Lua) src/portray/ + rules
▼
@@ -100,10 +108,14 @@ render Surface ──► MVT / MLT tiles (src/tiles/) + MapLibre style.json +
└───► PNG raster / vector PDF / terminal text (src/render/)
```
-The stages are separate Zig modules — `iso8211`, `s57`, `s101`, `tiles`,
-`render`, `scene`, `style` — pure Zig with no libc; only the Lua portrayal
-(`portray`) and the sprite rasterizer (`sprite`) pull in C. See
-[the architecture docs](docs/docs/architecture.md).
+A native S-101 chart is read straight into the S-101 model — its in-band code
+tables already carry the S-101 class and attribute names — so no conversion runs;
+its `.001…` update files are applied on load. An S-57 cell is read into the S-57
+model and adapted (a best-effort, S-65-guided step; see
+[limitations](docs/docs/limitations.md)). The stages are separate Zig modules —
+`iso8211`, `s57`, `s101`, `tiles`, `render`, `scene`, `style` — pure Zig with no
+libc; only the Lua portrayal (`portray`) and the sprite rasterizer (`sprite`) pull
+in C. See [the architecture docs](docs/docs/architecture.md).
## Use it from Zig
@@ -151,6 +163,8 @@ and the asset/atlas generators. See [the C API docs](docs/docs/c-api.md).
The offline tool bakes charts and emits portrayal assets:
+Any `.000` — native S-101 or S-57 — works everywhere; the format is auto-detected.
+
```sh
zig build # builds zig-out/bin/tile57
tile57 bake CELL.000 -o out/ # one cell -> out/tiles/