@bloomsparkagency/imdf - IMDF Parser & Validator
The IMDF package is a highly performant, in-browser parser, validator, and exporter supporting the OGC / Apple Indoor Mapping Data Format (IMDF) 1.0.0 specification. It runs inside a Comlink Web Worker, unpacking and validating datasets without locking the browser's UI thread.
📂 Required IMDF File Taxonomy
A valid .imdf.zip contains separate GeoJSON layers. The parser verifies both mandatory and optional layers:
| Mandatory Layers | Optional Layers |
|---|---|
manifest.json | address.geojson |
venue.geojson | amenity.geojson |
building.geojson | anchor.geojson |
level.geojson | detail.geojson |
unit.geojson | fixture.geojson |
footprint.geojson | geofence.geojson |
kiosk.geojson | |
occupant.geojson | |
opening.geojson | |
relationship.geojson | |
section.geojson |
🩺 In-Browser Schema Validation & Integrity Rules
The validator implements three cascading logic steps inside the worker:
- Ajv Property Schema Checks: Enforces JSON Schema Draft-07 syntax constraints (~8 KB gzipped) on property keys, data types, and enum vocabulary.
- Geometry Rules Validation: Validates that GeoJSON feature shapes conform to literal IMDF standard rules:
- Building: Geometry MUST be null (
"geometry": null). - Footprint, Level, Unit, Venue, Section, Kiosk, Geofence, Fixture: Geometry MUST be Polygonal (
PolygonorMultiPolygon). - Opening: Geometry MUST be LineString (
"geometry": { "type": "LineString", ... }). - Amenity, Anchor: Geometry MUST be Point (
"geometry": { "type": "Point", ... }). - Detail: Geometry MUST be LineString or MultiLineString.
- Building: Geometry MUST be null (
- Integrity Validation Checks: The parser evaluates cross-layer spatial linkages and raises structured warnings/errors:
| Violation Code | Severity | Description |
|---|---|---|
FileMustBeValidGeoJSON | Violation (Error) | Input file is not valid JSON or lacks standard GeoJSON root properties. |
ManifestVersionMustBeValid | Violation (Error) | manifest.json does not declare version: "1.0.0". |
VenueCountMustBeExactlyOne | Violation (Error) | The archive contains zero or more than one venue feature. |
BuildingMustHaveAtLeastOneFootprint | Violation (Error) | A building record has no matching footprints defined in footprints.geojson. |
InvalidFeatureID | Violation (Error) | The feature ID is missing or is not a valid RFC-4122 v4 UUID string. |
VenueMustHaveAddress | Violation (Error) | The single venue record has no registered address_id binding. |
OpeningIsSuspiciouslyLarge | Warning | An opening LineString feature's length exceeds 45 meters. |
OpeningIsSuspiciouslySmall | Warning | An opening LineString feature's length is less than 0.8382 meters (33 inches). |
LevelMustBeFullyCoveredByUnits | Warning | The combined polygons of all units do not cover the footprint of the level (indicates unmapped corridors). |
💾 Export Profiles
The editor state can be exported as a compiled, zipped archive conforming to either Apple or Microsoft requirements.
1. Apple Indoor Maps Program Profile
Generates archives designed to pass Apple's strict Indoor Survey / Business Register submission gates:
- Enforces all 16 IMDF feature types.
- Enforces v4 UUID IDs for all layers.
- Includes mandatory
display_pointcoordinates onVenue,Building,Level, andUnitshapes. - Preserves the original
originUUID inmanifest.jsonacross incremental updates to allow Apple to trace changes easily.
2. Microsoft Places Profile
Generates lightweight archives structured for Microsoft Places desk and space bookings (requires only 4 required GeoJSON layers):
- The 4 Core Layers:
building.geojson,footprint.geojson,level.geojson,unit.geojson(plus optionalsection.geojsonandfixture.geojsonfor desk layouts). - SortOrder Synchronization: The level
ordinalvalue is mapped to match theSortOrderproperty in the Microsoft Places Directory. - Microsoft-Specific Extensions: Injects custom metadata extensions:
bearingon levels androtationon fixtures (to capture precise desk angles). - Correlation Map Template: Automatically creates a companion
mapfeatures.csvfile referencing corresponding building assets, allowing administrators to execute PowerShell mapping imports immediately:powershellImport-MapCorrelations -MapFilePath "imdf.zip" -CorrelationsFilePath "mapfeatures.csv" New-Map -BuildingId <PlaceId> -FilePath "imdf_correlated.zip"
