Map Render
"/home/yossef/notes/git/projects/maplibra/flows/Map Render.md"
path: maplibra/flows/Map Render.md
- **fileName**: Map Render
- **Created on**: 2026-06-16 00:48:42
Map Render
Purpose: Floor loading, fast render, and prepared swap pipeline.
Related: ../Home.md, ../Architecture.md, ../modules/Map Rendering.md, ../modules/Layer Management.md, ../modules/MVF Loading.md
Render Pipeline
1. Floor Data Request
UIManager.requestFloorChange(floorId)
→ dispatchEvent('floor-change-requested')
→ script.js: floorDataManager.loadAndRenderFloor(floorId)
2. Floor Data Loading
FloorDataManager.loadAndRenderFloor(floorId)
→ ensureFloorData(floorId) [cached? return]
→ mvfLoader.loadFloorData(floorId) [ZIP IO]
→ cache in floorDataCache
→ track memory size
→ evict old floors if needed
3. Fast Render (immediate)
applyFloorData(floorId, floorData, null, { fast: true })
→ LayerManager.renderFloorData({ fast: true })
→ Paint raw geometry, entrance IDs, locations
→ LayerManager.updateFloorVisibility(floorId)
→ setFloorLoading(false)
4. Prepared Data (async, background)
ensurePreparedFloorData(floorId)
→ geoPrepper.prepareFloor(payload) [Web Worker]
→ Returns: { styleLayers, doorFeatures, labelFeatures }
→ if request still active:
→ applyFloorData(floorId, floorData, prepared, { fast: false })
→ LayerManager.renderFloorData({ prepared })
→ LayerManager.addPreparedLabels(prepared.labelFeatures)
5. Request Cancellation
activeFloorRequestcounter increments on each callAbortControllerper floor for signal-based cancellationrequestId !== activeFloorRequestaborts stale callbacks- Ensures only the latest floor change paints the map
Memory Management
floorDataCache— LRU cache, max 4 floors by defaultfloorBytesTotal— tracked memory estimatememoryThreshold— configurable limit (default 100MB)performance.memory— JS heap usage check (evict if >80%)cleanupFloorData()— revokes object URLs, removes from cache
Important Files
src/app/floor-data.js— FloorDataManagersrc/app/geo-prep.js— GeoPreppersrc/workers/geo-worker.js— Geo prep workersrc/layer-manager.js— LayerManager.renderFloorData()
How It Connects
-
UIManagerdispatches floor change events -
script.jscallsFloorDataManager.loadAndRenderFloor() -
MVF Loaderprovides raw floor data -
Geo Workerprepares enriched data -
LayerManagerpaints everything on the map -
VisibilityManagerfilters by floorIdcontinue:[[]]
before:[[]]