feat(terrain): generate local DEMNAS 3D elevation terrain tiles replacing external demo source #97

Closed
opened 2026-10-15 00:03:34 +00:00 by yuris · 0 comments
Owner

This was generated by AI during triage.

Problem Statement

In src/lib/gis/dem-terrain.ts:7, 3D terrain elevation currently points to an external third-party demonstration endpoint:
https://demotiles.maplibre.org/terrain-tiles/{z}/{x}/{y}.png.
This violates docs/ARCHITECTURE.md §3 (which mandates BIG DEMNAS 0.27" elevation rasters for peat dome visualization) and creates an external runtime dependency that fails when offline.

Technical Specification

  1. Elevation Terrain Architecture:
    • Generate local Mapbox Terrain-RGB encoded tiles (elevation = -10000 + ((R * 256 * 256 + G * 256 + B) * 0.1)) or Cloud-Optimized GeoTIFF covering Indonesian peat provinces from DEMNAS rasters.
    • Serve tiles locally via Next.js /tiles/terrain/{z}/{x}/{y}.png or a local PMTiles terrain archive (public/tiles/terrain.pmtiles).
  2. Configuration in src/lib/gis/dem-terrain.ts:
    • Point TERRAIN_SOURCE.tiles to local endpoint /tiles/terrain/{z}/{x}/{y}.png or pmtiles:///tiles/terrain.pmtiles.
    • Fall back gracefully to flat 2D if terrain source is unreachable.
  3. Unit Tests:
    • Update src/lib/gis/__tests__/dem-terrain.test.ts to assert local endpoint configuration and protocol registration.

Acceptance Criteria

  • src/lib/gis/dem-terrain.ts no longer references external demotiles.maplibre.org.
  • Local terrain tile pipeline and endpoint verified.
  • Unit tests pass, vp check passes, build succeeds.
> *This was generated by AI during triage.* ## Problem Statement In `src/lib/gis/dem-terrain.ts:7`, 3D terrain elevation currently points to an external third-party demonstration endpoint: `https://demotiles.maplibre.org/terrain-tiles/{z}/{x}/{y}.png`. This violates `docs/ARCHITECTURE.md §3` (which mandates BIG DEMNAS 0.27" elevation rasters for peat dome visualization) and creates an external runtime dependency that fails when offline. ## Technical Specification 1. **Elevation Terrain Architecture**: - Generate local Mapbox Terrain-RGB encoded tiles (`elevation = -10000 + ((R * 256 * 256 + G * 256 + B) * 0.1)`) or Cloud-Optimized GeoTIFF covering Indonesian peat provinces from DEMNAS rasters. - Serve tiles locally via Next.js `/tiles/terrain/{z}/{x}/{y}.png` or a local PMTiles terrain archive (`public/tiles/terrain.pmtiles`). 2. **Configuration in `src/lib/gis/dem-terrain.ts`**: - Point `TERRAIN_SOURCE.tiles` to local endpoint `/tiles/terrain/{z}/{x}/{y}.png` or `pmtiles:///tiles/terrain.pmtiles`. - Fall back gracefully to flat 2D if terrain source is unreachable. 3. **Unit Tests**: - Update `src/lib/gis/__tests__/dem-terrain.test.ts` to assert local endpoint configuration and protocol registration. ## Acceptance Criteria - [x] `src/lib/gis/dem-terrain.ts` no longer references external `demotiles.maplibre.org`. - [x] Local terrain tile pipeline and endpoint verified. - [x] Unit tests pass, `vp check` passes, build succeeds.
yuris closed this issue 2026-10-15 01:21:20 +00:00
Sign in to join this conversation.
No labels
backend
frontend
No milestone
No project
No assignees
1 participant
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#97
No description provided.