View on GitHub

leaflet-city-mapper

A small 3D rendering engine for leaflet

Terrain

Source guide Project README

Loads elevation tiles and optional bridge data, applies terrain to the map and provides elevation sampling for other layers and interactions.

Elevation lifecycle

flowchart LR
  Input["Archive / COG / streamed Float32 tiles"] --> Load["Load DEM + optional bridges"]
  Load --> Apply["Apply terrain to map layers"]
  Apply --> Events["terrainchange / terrainready"]
  Events --> Consumers["Raster / models / traffic / walk"]
  Query["Elevation query"] --> Bridge{"Bridge elevation?"}
  Bridge -->|yes| Height["Elevation"]
  Bridge -->|no| DEM["Sample DEM"]
  DEM --> Height

Streamed tiles are 256 pixels. getElevation.js returns null when unavailable, not an actual zero. Removal aborts requests and releases terrain resources.

Related: cog, raster, geometry.