Skip to content

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.

ts
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 conceptIMDF feature
Mapvenue
Levellevel
Spaceunit
Dooropening
Connectionrelationship

Custom field mapping

ts
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

ts
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 issues

Supported DXF entities

EntityNotes
LINEConverted to LineString
LWPOLYLINEClosed → Polygon, open → LineString
ARCApproximated with 32-segment polyline
CIRCLEApproximated with 64-segment polygon
INSERT (block ref)Resolved recursively
TEXT / MTEXTPreserved 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:

tsx
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.

ts
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

OptionTypeDefaultDescription
format'png' | 'svg''png'Output format
sizenumber200Image size in pixels (PNG only)
errorCorrectionLevel'L' | 'M' | 'Q' | 'H''M'QR error correction
foregroundstring'#000000'Dark module colour
backgroundstring'#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.

Released under commercial licensing.