How raruto/leaflet-city-mapper works
Leaflet City Mapper is a WebGPU 3D rendering plugin exposed as Leaflet layers. The main user flow is to add a layer with a source, load and prepare geospatial or model data, and display it in a pitched or rotated map; users can also interact with features and control camera, walking, and simulated sunlight. The README documents the supported source types and controls, while sampled code shows the Leaflet integration, camera extensions, worker execution, and rendering-pipeline setup. Internal links for unsampled source and scene orchestration are left unverified.
Main entry points: layerInitialize.js Source initialization · index.js Leaflet layer API · render.js WebGPU rendering · mapCamera.js Map camera
Components 20
Leaflet integration
- Leaflet layer API
src/index.js - Source initialization
src/scene/layerInitialize.js - Native Leaflet layers
src/native/nativeLayer.js
Data sources
- Vector features
src/vector-style/evaluateStyle.js - MVT decoding
src/mvt/decodeVectorTile.js - PMTiles archives
src/archives/loadSource.js - COG imagery
src/cog/openCog.js - Raster tiles
src/raster/loadRasterTile.js - glTF models
src/models/loadModel.js - Terrain layers
src/native/loadGridTerrain.js
3D scene
- Geometry building
src/geometry/roofFootprint.js - Source workers
src/workers/runSourceWorker.js - WebGPU rendering
src/rendering/render.js - Mesh pipelines
src/rendering/drawPipeline.js
Map interaction
- Map camera
src/camera/mapCamera.js - Camera controls
src/controls/dragCamera.js - Feature picking
src/picking/raycast.js
Time and controls
- Walk control
src/walk/createWalk.js - Sunlight and time
src/sunlight/updateSun.js
Other components
- Map developer
Connections 19
- Map developer → Leaflet layer API: creates layer
README.md - Leaflet layer API → Source initialization: initializes source
src/index.js - Leaflet layer API → Map camera: extends map
src/index.js - Source initialization → Vector features: selects source
- Source initialization → PMTiles archives: selects source
- Source initialization → COG imagery: selects source
- Source initialization → Raster tiles: selects source
- Source initialization → glTF models: selects source
- Source initialization → Terrain layers: selects source
- Source initialization → Native Leaflet layers: initializes layers
- Vector features → MVT decoding: may decode tiles
- PMTiles archives → COG imagery: may read imagery
- Source workers → Geometry building: runs source jobs
- Geometry building → WebGPU rendering: supplies geometry
- WebGPU rendering → Mesh pipelines: creates pipelines
- Camera controls → Map camera: changes view
- Feature picking → Leaflet layer API: reports features
- Walk control → Map camera: controls movement
- Sunlight and time → WebGPU rendering: requests render