The External ID is a reference from your real-life data to a piece of MapsIndoors geodata.
In a large venue like a conference hall, headquarter, or university, every room will have a unique ID like 1.234AB or HALL_A in a naming scheme that makes sense to that organization.
All MapsIndoors geospatial objects contain an internal ID. While this can be used for performing lookups, it means that in general as a developer you'll need to either query for them, or create your own mapping tables against your own resources.
Our recommendation is to use the externalId as the identifier for an your system's ID or another external system of your choosing.
If you have a queue monitoring system and want to display some regularly updated statuses on a piece of geodata in MapsIndoors like a room, poi, or area, you can use the External ID as the common denominator between the systems.
There are many ways you can utilize the power of external ID as a reference point for one of your systems, and we recommend looking at the Integration API documentation and getting in touch to hear more about your options with this feature.
Alternatively, you might need to change the ID for a particular room in your physical building. It might be a large meeting room that is now split in two smaller rooms and one of them keeps that original ID. The external ID should then reflect your naming scheme, and not concern itself with the internal random identifier our database handed out to any of your rooms, as they can potentially be two new ones.
Historically, we referred to this as room ID, so if you see a property on an object when working with the SDK and see a roomId, it should be consistent with the external ID property.
Getting Locations by External ID
A method on MapsIndoors is available to retrieve locations by their external ID. This method generally assumes that your first party system will do querying of different data, and only need to use the externalId to find the equivalent MapsIndoors location.
The function on all 3 platforms functions similarly, returning an Array or List of Locations that match the supplied External ID strings.
The below example shows how to retrieve some MapsIndoors locations based on your own IDs from your system, e.g. 'extId1', 'extId2' and updates the corresponding MapsIndoors locations with display rules.
Implementation example
// Define arrays of external IDs for available and unavailable resourcesconstavailableExternalIds= ['extId1','extId2']; // Replace with your actual IDsconstunavailableExternalIds= ['extId3','extId4']; // Replace with your actual IDs// Fetch locations based on external IDsasyncfunctionfetchLocationsByExternalIds(externalIds) {constpromises=externalIds.map(id =>mapsindoors.services.LocationsService.getLocationsByExternalId(id));returnawaitPromise.all(promises);}// Fetch locations for available and unavailable resourcesconstavailableLocations=awaitfetchLocationsByExternalIds(availableExternalIds);constunavailableLocations=awaitfetchLocationsByExternalIds(unavailableExternalIds);// Segment locations into Meeting Rooms and WorkstationsconstavailableMeetingRooms=availableLocations.filter(location =>location.properties.type ==='MeetingRoom');constavailableWorkstations=availableLocations.filter(location =>location.properties.type ==='Workstation');constunavailableMeetingRooms=unavailableLocations.filter(location =>location.properties.type ==='MeetingRoom');constunavailableWorkstations=unavailableLocations.filter(location =>location.properties.type ==='Workstation');// Extract MapsIndoors location IdsconstavailableMeetingRoomIds=availableMeetingRooms.map(location =>location.id);constunavailableMeetingRoomIds=unavailableMeetingRooms.map(location =>location.id);constavailableWorkstationIds=availableWorkstations.map(location =>location.id);constunavailableWorkstationIds=unavailableWorkstations.map(location =>location.id);// Set display rules for Meeting RoomsmapsIndoorsInstance.setDisplayRule(availableMeetingRoomIds, { polygonVisible:true, polygonFillColor:"#90ee90", polygonFillOpacity:1, polygonZoomFrom:16, polygonZoomTo:22, visible:true,});mapsIndoorsInstance.setDisplayRule(unavailableMeetingRoomIds, { polygonVisible:true, polygonFillColor:"#ff4d4d", polygonFillOpacity:1, polygonZoomFrom:16, polygonZoomTo:22, visible:true,});// Set display rules for WorkstationsmapsIndoorsInstance.setDisplayRule(availableWorkstationIds, { model3DVisible:true, model3DModel:'your_3D_model_URL_for_available_workstations', model3DZoomFrom:16, model3DZoomTo:22, visible:true,});mapsIndoorsInstance.setDisplayRule(unavailableWorkstationIds, { model3DVisible:true, model3DModel:'your_3D_model_URL_for_unavailable_workstations', model3DZoomFrom:16, model3DZoomTo:22, visible:true,});
Adding Geospatial Criteria to Your Own Search
You may wish to have some kind of recommendation system, so returning a list of your objects from your system might get a benefit to adding geospatial information.
Find all the nearby rooms that require cleaning
Find the closest nearby available meeting room
Get me all of the service orders tickets on this floor
Let's dig into how to implement this
First and foremost, the Map is not required
Load the MapsIndoors SDK
Use the relevant script tag for the MapsIndoors SDK. There is no API directly accessible as a developer, so the script tag must be run and therefore you need to have a javascript environment.
As of the date of writing this Dec, 2023 the most recent version is
However, you can find the latest version of our SDK here.
Use the getLocationsByExternalId method with whatever list of IDs are returned from your own search handled outside of MapsIndoors.
// Define arrays of external IDs for available and unavailable resources
const availableExternalIds = ['extId1', 'extId2']; // Replace with your actual IDs
// Fetch locations based on external IDs
async function fetchLocationsByExternalIds(externalIds) {
const promises = externalIds.map(id => mapsindoors.services.LocationsService.getLocationsByExternalId(id));
return await Promise.all(promises);
}
// Fetch locations for available and unavailable resources
const availableLocations = await fetchLocationsByExternalIds(availableExternalIds);
For a more full implementation to demonstrate this