Skip to content

Add vector tiles based map uploader (prototype) - #22

Merged
byo merged 5 commits into
mainfrom
vector-tiles
Nov 18, 2026
Merged

byo merged 5 commits into
mainfrom
vector-tiles

Conversation

@byo

@byo byo commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

What

Prototype of a vector tiles based Cinode map, as an alternative to the PNG tiles pipeline:

  1. maps-vector-uploader (cmd/maps-vector-uploader, pkg/vectormap) – publishes into cinode:

    • index.html – MapLibre GL JS viewer, style.json – map style (OSM Bright, OpenMapTiles schema),
    • tiles/{z}/{x}/{y}.pbf – pre-generated, uncompressed vector tiles (e.g. from Planetiler) from one or more directories; later directories override earlier ones, so detailed regions can be layered over a low-zoom world map,
    • optional assets directory (MapLibre build, fonts, sprites).

    Configured through env variables like maps-tile-uploader: CINODE_DATASTORE, CINODE_MAPTILES_WRITERINFO / CINODE_MAPTILES_NEW_WRITERINFO, CINODE_VECTOR_TILES_DIRS, CINODE_VECTOR_ASSETS_DIR, CINODE_VECTOR_PARALLELISM. Tiles are uploaded in parallel; the tiles directory is reset first so the result is a snapshot of the sources, unchanged tiles produce the same blobs.

  2. Client-side over-zoom + tiles/coverage.json – regions can have different max zoom. Missing tiles are rendered from the closest existing ancestor (overzoom.mjs, a MapLibre protocol clipping and rescaling the ancestor tile). coverage.json holds per-zoom bounding rectangles of existing tiles (one per source directory) so the viewer doesn't probe for missing tiles; it stays small regardless of tile count.

  3. Docker image, assets script, docs – Dockerfile.maps-vector-uploader + images workflow entry, toolbox/fetch-vector-assets.sh, README section on generating tiles with Planetiler and uploading them.

Why

PNG tiles are large, bake in the style and are limited in max zoom. Vector tiles are much smaller, styled on the client, and over-zoom well beyond the generated max zoom.

Testing

  • Every commit: gofmt, go mod tidy -diff, build, vet, tests (incl. -race) and golangci-lint (0 issues).
  • End to end: world z0–6 + Luxembourg z0–14 uploaded to a local datastore and served by cinode/go master web_proxy; viewer, style, tiles and coverage.json served with correct content types, z13 and over-zoomed z10 rendered correctly in Chrome.

Notes for reviewers

  • The new image builds for the same platforms as maps-tile-uploader (cross-compiled locally for arm/v6 and riscv64); the Docker build itself wasn't run locally.
  • Helm chart and release-chart-version.sh don't use the new image yet.
  • fetch-vector-assets.sh was only syntax-checked (no shellcheck available locally).

🤖 Generated with Claude Code

byo and others added 5 commits November 18, 2026 21:57
The new command publishes a vector tiles based map into cinode:

* index.html - MapLibre GL JS based viewer with rotate buttons,
* style.json - OpenMapTiles schema style derived from OSM Bright with
  OSM Carto-like colors, road widths and house numbers,
* tiles - pre-generated vector tiles (e.g. from Planetiler) taken from
  one or more directories, later directories override earlier ones so
  that detailed regions can be layered over a low-zoom world map,
* optional assets directory (MapLibre build, fonts, sprites), fetched
  with toolbox/fetch-vector-assets.sh.

Regions may have different max zoom levels: missing tiles are rendered
by the viewer from the closest existing ancestor tile (overzoom.mjs),
tiles/coverage.json lists per-zoom bounding rectangles of existing
tiles so that non-existing ones are not probed.

Like maps-tile-uploader it is configured through environment variables.
The writer info can be kept in a file (CINODE_MAPTILES_WRITERINFO_FILE),
a new link is created and saved there when the file doesn't exist, and
the map entrypoint can be saved after the upload
(CINODE_MAPTILES_ENTRYPOINT_FILE), so that consecutive runs update the
same map without passing secrets around.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* maps-vector-uploader - the uploader with viewer assets bundled at
  build time (CINODE_VECTOR_ASSETS_DIR points to them by default),
* maps-vector-generator - the whole vector map pipeline in one image:
  Planetiler (the base image), osmium, the uploader with assets and
  scripts run as a plain sequence of commands:
  - prepare-osm-extract downloads extracts and polygons of regions (with
    retries) and merges them with osmium, skipping the merge when
    nothing has changed; tiles along borders of neighbouring regions
    then contain data of all of them,
  - generate-vector-tiles runs Planetiler for a local extract.

The generator is built for linux/amd64 and linux/arm64 only since those
are the only platforms of the Planetiler image.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
All current resources belong to the raster map pipeline and are only
rendered with mapType=raster (the default, so existing deployments are
not affected). PostgreSQL is now an optional dependency
(postgres.enabled) since the vector map doesn't need it; the chart
fails with a clear message if it's left enabled for the vector map.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With mapType=vector the chart runs a single CronJob whose container
(maps-vector-generator image) runs the steps one after another:
downloads and merges extracts of enabled regions (pbf + poly), generates
low zoom world tiles and then tiles of all regions at once limited to
their polygons, and uploads them with maps-vector-uploader.

Downloaded data, generated tiles, the default local datastore and the
map link live on a persistent data volume which is kept when the release
is removed, so consecutive runs only fetch newer extracts and update the
same map. The datastore and writer info can also be given as values or
existing secrets like for the raster map.

An optional viewer (cinode web proxy) serves the map from the datastore
once the first upload is done, exposed with a service and optionally an
ingress.

The new image is included in the release script.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
minikube-test.sh takes a preset (raster, vector-luxembourg,
vector-poland, vector-border), starts minikube when needed, builds
images with the local docker and loads them into minikube (works with
any minikube container runtime), deploys the chart and for vector maps
starts the generation right away.

minikube-view.sh follows the vector map generation and serves the map
once the first upload is done, restarting port forwarding when it drops;
ADDRESS=0.0.0.0 makes it reachable from other devices in the local
network.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@byo
byo merged commit eda4016 into main Nov 18, 2026
6 checks passed
@byo
byo deleted the vector-tiles branch November 18, 2026 21:02
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