feat(pipeline): compile static peat and KHG vector tiles and serve PMTiles (Issue 2) #10

Merged
yuris merged 1 commit from feat/issue-2-pmtiles-pipeline into main 2026-10-14 19:55:06 +00:00
Owner

Summary

Implements Issue 2: RustGIS-compiled static peat and KHG vector tile pipeline.

  • Compiles 47 MB GeoJSON down to 3.2 MB PMTiles archives (peat_soil.pmtiles and khg.pmtiles) via tippecanoe.
  • Serves PMTiles with full HTTP Range (206 Partial Content) via /tiles/[file] route handler.
  • Adds pmtiles-protocol.ts to register pmtiles:// protocol in MapLibre GL.
  • Implements graduated depth symbology for peat soil polygons.
  • Adds sky-400 dashed boundary lines for KHG.
  • Adds floating glassmorphism layer toggles widget.

Closes #2

## Summary Implements Issue 2: RustGIS-compiled static peat and KHG vector tile pipeline. - Compiles 47 MB GeoJSON down to 3.2 MB PMTiles archives (`peat_soil.pmtiles` and `khg.pmtiles`) via `tippecanoe`. - Serves PMTiles with full HTTP Range (`206 Partial Content`) via `/tiles/[file]` route handler. - Adds `pmtiles-protocol.ts` to register `pmtiles://` protocol in MapLibre GL. - Implements graduated depth symbology for peat soil polygons. - Adds sky-400 dashed boundary lines for KHG. - Adds floating glassmorphism layer toggles widget. Closes #2
yuris-bot approved these changes 2026-10-14 19:52:48 +00:00
yuris-bot left a comment

Review: Issue 2 - RustGIS-compiled static peat and KHG vector tile pipeline

Verdict: APPROVE


Five-Axis Review Summary

1. Correctness

  • Vector Tile Compilation: GeoJSON sources compiled down to peat_soil.pmtiles (2.4 MB) and khg.pmtiles (811 KB), well under the 12 MB budget.
  • HTTP Range Serving: /tiles/[file] correctly implements Accept-Ranges: bytes, Content-Range: bytes start-end/total, status 206 Partial Content (for ranged requests), and 200 OK (for full fetches).
  • Symbology: Graduated depth colors correctly match specifications (#fef08a through #7c2d12), with KHG sky-400 dashed line layer (#38bdf8, line-dasharray [3, 2]).
  • Dynamic Toggling: Instant layer visibility toggling without canvas recreation using MapLibre setLayoutProperty.

2. Readability & Simplicity

  • Clean separation between layer specifications (peat-soil-layer.tsx, khg-layer.tsx), control UI (layer-toggles.tsx), and protocol registration (pmtiles-protocol.ts).
  • No speculative abstractions or dead code.

3. Architecture

  • Modular GIS design fitting the App Router structure.
  • Protocol registration cleanly cached with Protocol singleton.

4. Security & Hardening (Consideration)

  • In src/app/tiles/[file]/route.ts: getSafeFilePath strips non-alphanumeric characters, but stats.isFile() check is recommended to guard against directory requests (e.g., /tiles/.. throwing EISDIR). File extension constraint (.pmtiles) can also be enforced. (Non-blocking, suggested for next pass).

5. Performance

  • 3.2 MB vector tile payload replaces 47 MB raw GeoJSON.
  • HTTP byte-range serving allows map client to fetch only required bounding box tiles.
  • Zero frame drops observed on layer toggling.

Ponytail Audit

  • Dependencies: Only pmtiles added, required for client-side raster/vector PMTiles decompression.
  • Complexity: Zero bloat. Lean and focused on Issue 2 deliverables.

Verification

  • vp check: All 78 files passed formatting and zero lint/type errors.
  • next build: Static generation and dynamic route registration succeeded cleanly.
  • pmtiles magic header and byte-range slicing verified.
# Review: Issue 2 - RustGIS-compiled static peat and KHG vector tile pipeline ### Verdict: **APPROVE** --- ### Five-Axis Review Summary #### 1. Correctness - **Vector Tile Compilation**: GeoJSON sources compiled down to `peat_soil.pmtiles` (2.4 MB) and `khg.pmtiles` (811 KB), well under the 12 MB budget. - **HTTP Range Serving**: `/tiles/[file]` correctly implements `Accept-Ranges: bytes`, `Content-Range: bytes start-end/total`, status `206 Partial Content` (for ranged requests), and `200 OK` (for full fetches). - **Symbology**: Graduated depth colors correctly match specifications (`#fef08a` through `#7c2d12`), with KHG sky-400 dashed line layer (`#38bdf8`, line-dasharray `[3, 2]`). - **Dynamic Toggling**: Instant layer visibility toggling without canvas recreation using MapLibre `setLayoutProperty`. #### 2. Readability & Simplicity - Clean separation between layer specifications (`peat-soil-layer.tsx`, `khg-layer.tsx`), control UI (`layer-toggles.tsx`), and protocol registration (`pmtiles-protocol.ts`). - No speculative abstractions or dead code. #### 3. Architecture - Modular GIS design fitting the App Router structure. - Protocol registration cleanly cached with `Protocol` singleton. #### 4. Security & Hardening (Consideration) - In `src/app/tiles/[file]/route.ts`: `getSafeFilePath` strips non-alphanumeric characters, but `stats.isFile()` check is recommended to guard against directory requests (e.g., `/tiles/..` throwing `EISDIR`). File extension constraint (`.pmtiles`) can also be enforced. (Non-blocking, suggested for next pass). #### 5. Performance - 3.2 MB vector tile payload replaces 47 MB raw GeoJSON. - HTTP byte-range serving allows map client to fetch only required bounding box tiles. - Zero frame drops observed on layer toggling. --- ### Ponytail Audit - **Dependencies**: Only `pmtiles` added, required for client-side raster/vector PMTiles decompression. - **Complexity**: Zero bloat. Lean and focused on Issue 2 deliverables. --- ### Verification - `vp check`: All 78 files passed formatting and zero lint/type errors. - `next build`: Static generation and dynamic route registration succeeded cleanly. - `pmtiles` magic header and byte-range slicing verified.
yuris-bot approved these changes 2026-10-14 19:54:50 +00:00
yuris-bot left a comment

Approved Issue 2 implementation

Approved Issue 2 implementation
yuris merged commit 754be57c08 into main 2026-10-14 19:55:06 +00:00
Sign in to join this conversation.
No reviewers
No labels
backend
frontend
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
yuris/titik-gambut-next!10
No description provided.