Migrating from MVFv1
Mappedin has evolved the Mappedin Venue Format (MVF) and released MVFv2. This new specification aims to simplify the data structure of MVF and make it easier and more efficient to work with. This guide explains the changes made between version 1 and version 2.
The data model of many GeoJSON and JSON files within the MVF has changed. Please refer to the MVFv1 Data Model Guide and MVFv2 Data Model Guide for specification details. The remainder of this guide will address general changes that affect the MVF as a whole.
File Structure Changes
MVFv2 has consolidated some data that was stored in multiple files into a single file. The directory path to some files has also changed. The table below outlines these changes.
Data | MVFv1 File Path | MVFv2 File Path |
---|---|---|
Connection | connection/<map_1_id>.geojson connection/<map_2_id>.geojson ...etc | connection.geojson |
Levels / Floors | levels/<level_1_id>.geojson levels/<level_2_id>.geojson ...etc | floors.geojson floorstack.json |
Node | node/<map_1_id>.geojson node/<map_2_id>.geojson ...etc | node.geojson |
Categories | category.geojson | enterprise/categories.geojson |
Locations | location.geojson | enterprise/locations.geojson |
Floors
The handling of levels (now called floors) has changed. MVFv2 introduces a dedicated floor.geojson
file that contains information about each floor, including its ID, name, and elevation. It also adds floorstack.json
that groups floors found in the same building. This replaces the previous system in MVFv1 where level information was distributed across multiple files in a 'level' folder.
Connections
Connection data, which in MVFv1 was stored in separate files for each level, is consolidated into a single connection.json
file in MVFv2. This change simplifies the management of inter-floor connections.
Naming Conventions
MVFv1 intermixed terms "level" and "map" to describe the map of a floor of a building. MVFv2 uses "floor" instead of "level".
ID Format Changes
MVFv1 IDs are strings made of random letter number combinations. MVFv2 uses shorter, prefixed IDs (i.e., "f_" for floors, "s_" for spaces).
Styles
In MVFv2, styles are consolidated into a single styles.json
file. This change allows for more centralized and efficient style management.
Centralized Style File:
- MVFv1: Styles are embedded within individual data files.
- MVFv2: Uses a dedicated
styles.json
file for all styling information.
Style Code Example
The following code examples extract the color of a space.
MVFv1: Accesses the feature.properties.color
directly from a space.
const spacesLayer = new GeoJsonLayer({ id: "spaces-layer", data: spacesData.features.filter((f) => f.geometry.type === "Polygon"), getFillColor: (feature) => { return ( hexToRGB((feature as Feature).properties!.color) || [255, 255, 255, 255] ); }, getLineWidth: 0.1,});
MVFv2 Reads the color from the stylesheet file.
const roomStyles = styles["Rooms"]; const roomLayer = new GeoJsonLayer({ id: "room-layer", // Filter by Space polygons that are defined in the Rooms style data: spaceData.features.filter((f: Feature) => roomStyles.polygons.includes(f.properties!.id) ), getFillColor: hexToRGB(roomStyles.color), // Apply Walls polygon color stroked: false, // No outline });
const hallwayStyles = styles["Hallways"]; const hallwayLayer = new GeoJsonLayer({ id: "hallway-layer", // Filter by Space polygons that are defined in the Hallways style data: spaceData.features.filter((f: Feature) => hallwayStyles.polygons.includes(f.properties!.id) ), getFillColor: hexToRGB(hallwayStyles.color), // Apply Hallways polygon color stroked: false, // No outline });