MVF Loading

"/home/yossef/notes/git/projects/maplibra/modules/MVF Loading.md"

path: maplibra/modules/MVF Loading.md

- **fileName**: MVF Loading
- **Created on**: 2026-06-16 00:48:42

MVF Loading

Purpose: Parses MVF (Map View Format) ZIP bundles and exposes metadata plus per-floor payload loading.

Related: ../Home.md, ../Architecture.md, ./Asset System.md, ./Map Rendering.md, ./Pathfinding.md

What It Does

The MVF loader reads a ZIP file containing building geometry, floor definitions, styles, connections, and routing data. It parses the bundle in a Web Worker to avoid blocking the main thread, then exposes methods to load individual floor data on demand.

MVF Bundle Structure

See ./MVF Format.md for the complete bundle structure and per-file documentation.

Loading Modes

1. URL Load (createMVFLoader(url))

2. File Upload (createMVFLoaderFromFile(file))

3. Asset Root (createMVFLoaderFromAssetRoot(root))

4. Cache Restore (createCachedMVFLoader(entry))

Worker Protocol

The MVF worker (src/workers/mvf-worker.js) uses a simple request/response protocol:

The incrementing id lets multiple floor loads share one worker safely.

Floor Data Loading

After the initial bundle parse, individual floors are loaded lazily:

Important Files

How It Connects