Skip to main content

tile57

Not for navigation

This is not a certified or tested navigation product. Do not rely on it for real-world navigation. See Known limitations.

tile57 is a nautical chart engine. It reads both native IHO S-101 ENC charts — the S-100-based successor format hydrographic offices are beginning to publish — and legacy IHO S-57 ENC cells (each cell is one electronic navigational chart, compiled for one scale; NOAA and others publish thousands). The format is detected from the chart file: a native S-101 dataset feeds the portrayal model directly, while an S-57 chart is first converted to the S-101 data model — a best-effort step, since S-57 has no perfect S-101 translation (see Known limitations). Either way, tile57 runs the official IHO S-101 Portrayal Catalogue in embedded Lua to decide how each feature is drawn, producing S-101 symbology (the successor to S-52).

The primary output is vector tiles, fetched by (z, x, y): MapLibre Tiles (MLT, the default) or Mapbox Vector Tiles (MVT). Alongside the tiles, tile57 emits the matching MapLibre GL style and the portrayal assets it references — colour tables, line styles, and the sprite and area-fill pattern atlases — so a renderer such as MapLibre draws a complete chart from tile57's output alone.

tile57 also contains a native S-52 rendering engine: the same scene that becomes tiles can be drawn straight to PNG, deterministic vector PDF, or a terminal (Unicode grid / kitty graphics), with the mariner's display settings evaluated live — no browser or GPU involved.

The whole engine is one Zig library behind a C ABI, with Go bindings in the repo; it compiles natively (Linux, macOS, Windows) or to WASM.

The pipeline

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 feature records
│ S-101 portrayal (embedded Lua) src/portray/ + rules

portrayal instruction stream src/s101/ (instructions)
│ scene generation src/scene/ (project + clip + draw calls)

render Surface ──► MVT / MLT tiles + PMTiles (src/tiles/) + MapLibre style.json + assets
└───► PNG raster / vector PDF / terminal text (src/render/)

This is the flow for one chart. The organizing principle is bake, then compose: each source chart bakes once to its own PMTiles archive, and every output — a served tile, a PNG, a query — is produced from baked archives, with overlapping charts stitched into one on demand by the runtime compositor.

The memory model

The engine holds only its working set:

  • Lazy, per-chart reads. A multi-chart ENC_ROOT is indexed cheaply (band
    • bbox); a streaming open reads a chart's bytes only when a metadata or feature query needs them (and frees them on eviction), so a host holds only the working set — not the whole catalogue.
  • Per-chart bakes, composed on demand. Each chart bakes to its own PMTiles at its compilation scale, so a bake holds one chart at a time; the runtime compositor mmaps the archives and stitches the charts by (z, x, y) on demand through an ownership partition, so serving never loads the chart set either.
  • Pure-Zig core. The foundational format/encode modules (iso8211, s57, s101, tiles, render, scene, style) have no libc; only the Lua portrayal (portray) and the sprite rasterizer (sprite) pull in C.

Portrayal

tile57 runs the official IHO S-101 Portrayal Catalogue — the real Lua rule files — in embedded Lua 5.4. The tiles carry S-52 colour tokens (never RGB), and the generated colortables.json resolves those tokens to Day / Dusk / Night hex, so a renderer can switch palette without regenerating tiles.

Where to go next

  • Installation — Zig 0.16, submodules, zig build.
  • Getting Started — bake charts and fetch a tile from Zig or C.
  • The CLItile57 bake / render / inspect commands.
  • Zig API — the @import("tile57") surface.
  • C API — the tile57_* C ABI (include/tile57.h).
  • Architecture — the pipeline and the Zig packages.
  • Tile Schema — the vector-tile layer contract.
  • The Rendering Engine — the native S-52 pixel path: PNG/PDF renders, the Surface/Canvas architecture, and how to extend it.
  • Known Limitations — what does not render yet.