Query API for advanced data filtering and retrieval.
Provides powerful querying capabilities to filter and find map elements based on various criteria.
Search API for MapData
Provides full-text search capabilities across all map locations, with support for suggestions, filtering, and result ranking.
// Enable search
const mapData = await getMapData({ search: { enabled: true } });
// or
await mapData.Search.enable();
// Perform a search query
const results = await mapData.Search.query('Coffee Shop');
console.log(results.locations);
// Get search suggestions
const suggestions = await mapData.Search.suggest('Coff');
console.log(suggestions);
const results = await mapData.Search.query('Shop', {
categories: ['retail'],
floor: mapData.getByType('floor')[0]
});
The approximate center coordinate (Coordinate) of the map.
The center coordinate of the map.
Gets the natural bearing of the map.
The natural bearing represents the orientation of the map relative to true north. This is useful for aligning the map with compass directions or external mapping systems.
The natural bearing in degrees.
Changes the language of the map data.
Updates all text content (names, descriptions, etc.) to the specified language. The map will emit a 'language-change' event when the language is updated.
The ISO 639-1 language code to change to (e.g., 'en' for English, 'fr' for French). Check (EnterpriseVenue.languages) for available languages
A promise that resolves when the language change is complete.
Retrieves map elements by their external ID.
External IDs are custom identifiers that can be assigned to map elements. This is useful for integrating with external systems or databases.
The type of element to retrieve.
The external identifier to search for.
An array of elements with the matching external ID.
Retrieves a specific map feature by its type and ID.
Use this method to find individual map elements when you know their exact ID. This is more efficient than filtering collections for specific elements.
The type of element to retrieve.
The unique identifier of the element.
The map element if found, undefined otherwise.
const space = mapData.getById('space', 'space-123');
if (space) {
console.log(`Found space: ${space.name}`);
}
const floor = mapData.getById('floor', 'floor-1');
if (floor) {
console.log(`Floor level: ${floor.level}`);
}
const door = mapData.getById('door', 'door-main-entrance');
if (door) {
console.log(`Door type: ${door.type}`);
}
In general, it is better to specify the type if you know it, since you get better type safety.
const element = mapData.getById('unknown', 'element-123');
if (!element) {
console.log(`Element not found`);
} else if (Space.is(element)) {
console.log(`Found space: ${element.name}`);
} else if (Door.is(element)) ...
Retrieves a specific map feature by its type and ID.
Use this method to find individual map elements when you know their exact ID. This is more efficient than filtering collections for specific elements.
The type of element to retrieve.
The unique identifier of the element.
The map element if found, undefined otherwise.
const space = mapData.getById('space', 'space-123');
if (space) {
console.log(`Found space: ${space.name}`);
}
const floor = mapData.getById('floor', 'floor-1');
if (floor) {
console.log(`Floor level: ${floor.level}`);
}
const door = mapData.getById('door', 'door-main-entrance');
if (door) {
console.log(`Door type: ${door.type}`);
}
In general, it is better to specify the type if you know it, since you get better type safety.
const element = mapData.getById('unknown', 'element-123');
if (!element) {
console.log(`Element not found`);
} else if (Space.is(element)) {
console.log(`Found space: ${element.name}`);
} else if (Door.is(element)) ...
Retrieves a specific map feature by its type and ID.
Use this method to find individual map elements when you know their exact ID. This is more efficient than filtering collections for specific elements.
The type of element to retrieve.
The unique identifier of the element.
The map element if found, undefined otherwise.
const space = mapData.getById('space', 'space-123');
if (space) {
console.log(`Found space: ${space.name}`);
}
const floor = mapData.getById('floor', 'floor-1');
if (floor) {
console.log(`Floor level: ${floor.level}`);
}
const door = mapData.getById('door', 'door-main-entrance');
if (door) {
console.log(`Door type: ${door.type}`);
}
In general, it is better to specify the type if you know it, since you get better type safety.
const element = mapData.getById('unknown', 'element-123');
if (!element) {
console.log(`Element not found`);
} else if (Space.is(element)) {
console.log(`Found space: ${element.name}`);
} else if (Door.is(element)) ...
Retrieves all map elements of a specific type.
This is the primary method for accessing collections of map elements. Use the typed overloads for better TypeScript support.
The type of elements to retrieve.
An array of elements of the given type.
The points of interest (PointOfInterest) on the map.
The enterprise locations (EnterpriseLocation) on the map.
The enterprise categories (EnterpriseCategory) on the map.
The enterprise venues (EnterpriseVenue) on the map.
The location profiles (LocationProfile) on the map.
The location categories (LocationCategory) on the map.
Calculates directions between two or more locations.
Provides turn-by-turn navigation instructions and a path between the specified locations. The path avoids obstacles and follows walkable routes.
The starting location(s).
The destination location(s).
Optionaloptions: TGetDirectionsOptionsOptional configuration for the directions calculation.
A Directions object containing the route, or undefined if no route is found.
const space1 = mapData.getById('space', 'space-123');
const space2 = mapData.getById('space', 'space-456');
if (space1 && space2) {
const directions = await mapData.getDirections(space1, space2);
if (directions) {
console.log(`Distance: ${directions.distance}m`);
console.log(`Duration: ${directions.duration}s`);
directions.instructions.forEach(instruction => {
console.log(instruction.action.type);
});
}
}
const directions = await mapData.getDirections(space1, space2, {
accessible: true,
smoothing: { radius: 3 }
});
Calculates directions to multiple destinations.
Provides routes from a single starting point to multiple destinations. Useful for finding the best route when visiting multiple locations.
The starting location.
An array of destination locations or arrays of destinations.
Optionaloptions: TGetDirectionsOptionsOptional configuration for the directions calculation.
An array of Directions objects, one for each destination.
const start = mapData.getById('space', 'entrance');
const destinations = [
mapData.getById('space', 'store-1'),
mapData.getById('space', 'store-2'),
mapData.getById('space', 'restaurant')
].filter(Boolean);
const allDirections = await mapData.getDirectionsMultiDestination(start, destinations);
allDirections.forEach((directions, index) => {
console.log(`Route ${index + 1}: ${directions.distance}m`);
});
Calculates the straight-line distance between two locations.
Returns the direct distance between two points, not following walkable paths. For navigation distances, use getDirections.
The starting location.
The destination location.
The distance in meters.
Get the current environment configuration.
Returns the environment settings including API endpoints and configuration.
Environment configuration object
Retrieves the GeoJSON representation of a map element.
Returns the geometric data for a map element in GeoJSON format, which can be used for custom rendering, analysis, or integration with mapping libraries.
The map element to get GeoJSON for.
The GeoJSON representation of the element.
Unsubscribe from MapData events.
The name of the event to unsubscribe from.
The callback function that was previously registered with on().
Subscribe to MapData events.
Listen for events emitted by the MapData instance such as language changes.
The name of the event to listen for.
The callback function to execute when the event is emitted.
Exports the map data as a JSON bundle.
Creates a JSON representation of the map data that can be easily parsed and manipulated. Useful for data analysis, debugging, or integration with other systems.
Configuration options for the export.
OptionaldownloadLanguagePacks?: booleanWhether to include language packs in the export.
A JSON bundle containing the map data.
MapData in Mappedin JS
MapData is the core data container for all map information, providing access to spaces, floors, points of interest, and navigation capabilities. It serves as the foundation for building interactive indoor mapping applications.
Features
Example Usage
Data Access Patterns
getByType()for all elements of a typegetById()for individual elementsgetByExternalId()for custom identifiersgetGeoJSON()for geometric dataNavigation Features
getDirections(): Route between two locationsgetDirectionsMultiDestination(): Route with multiple destinationsgetDistance(): Calculate distance between locationsMore Information
Represents the data for a map, providing access to map elements like spaces, floors, and points of interest.