Import & Export: MVF, DXF, and QR Codes (F55–F57)
MVF Venue Import (F55)
parseMVF converts a Mappedin MVF (.mvf) venue file into an IMDF GeoJSON feature collection that the SDK can render directly.
import { parseMVF } from '@diginestai/imdf';
const response = await fetch('/venues/my-mall.mvf');
const buffer = await response.arrayBuffer();
const imdf = await parseMVF(buffer);
// imdf: IMDFFeatureCollection — pass to <SpatialMap buildings={[imdf]} />The conversion maps MVF concepts to IMDF features:
| MVF concept | IMDF feature |
|---|---|
Map | venue |
Level | level |
Space | unit |
Door | opening |
Connection | relationship |
Custom field mapping
const imdf = await parseMVF(buffer, {
nameField: 'displayName', // MVF property → IMDF name
categoryMap: { // MVF category → IMDF category
'retail': 'restroom',
},
});DXF / AutoCAD Floor-Plan Import (F56)
DXF import is available in the editor package and surfaces through the GeoReferencingWizard UI. It handles AutoCAD entities including LINE, LWPOLYLINE, ARC, CIRCLE, INSERT (blocks), and TEXT.
Programmatic import
import { importDXF } from '@diginestai/editor';
const file = event.target.files[0]; // File from <input type="file" />
const result = await importDXF(file, {
snapToGrid: true,
gridSize: 0.1, // 10 cm in metres
crs: 'EPSG:4326',
});
// result.features — GeoJSON features ready for editor canvas
// result.warnings — non-fatal parse issuesSupported DXF entities
| Entity | Notes |
|---|---|
LINE | Converted to LineString |
LWPOLYLINE | Closed → Polygon, open → LineString |
ARC | Approximated with 32-segment polyline |
CIRCLE | Approximated with 64-segment polygon |
INSERT (block ref) | Resolved recursively |
TEXT / MTEXT | Preserved as GeoJSON properties.label |
Unsupported entities (3D solids, hatches, viewports) are silently skipped and listed in result.warnings.
Geo-referencing wizard
For interactive import with snapping and coordinate assignment, use the built-in wizard:
import { GeoReferencingWizard } from '@diginestai/editor';
<GeoReferencingWizard
onComplete={(features) => loadFeaturesIntoEditor(features)}
onCancel={() => setWizardOpen(false)}
/>QR Code Generation (F57)
generateQRCode produces a PNG data URL or SVG string encoding a deep-link URL (or any arbitrary string) as a QR code.
import { generateQRCode } from '@diginestai/core';
import { buildDeepLink } from '@diginestai/core';
const deepLink = buildDeepLink({ floor: 1, lat: 43.645, lng: -79.38, zoom: 18 });
const qr = await generateQRCode(deepLink, {
format: 'png',
size: 256, // pixels
errorCorrectionLevel: 'M',
foreground: '#000000',
background: '#ffffff',
});
// Render in an <img> tag
// <img src={qr.dataUrl} alt="Map QR code" />Options
| Option | Type | Default | Description |
|---|---|---|---|
format | 'png' | 'svg' | 'png' | Output format |
size | number | 200 | Image size in pixels (PNG only) |
errorCorrectionLevel | 'L' | 'M' | 'Q' | 'H' | 'M' | QR error correction |
foreground | string | '#000000' | Dark module colour |
background | string | '#ffffff' | Light module colour |
Using the ShareControl
The <ShareControl> UI component (F43) wraps generateQRCode and buildDeepLink into a single button. See Wayfinding & Selection UI Controls.
