Wrld.map.indoors

function onEnter(event) {
    console.log("Entered indoor map: " + event.indoorMap.getIndoorMapName());
}

function onExit(event) {
    console.log("Exited indoor map");
}
map.indoors.on("indoormapenter", onEnter);
map.indoors.on("indoormapexit", onExit)

Methods

map.indoors.isIndoors()

Returns a boolean indicating whether an indoor map is currently being viewed.

map.indoors.enter(indoorMap, config)

Move the camera into an indoor map.

Argument Type Description
indoorMap IndoorMapEntrance | IndoorMap | string The entrance to an indoor map to enter, or the indoor map itself, or the ID of the map as a string.
config object An object containing optional parameters, described below.

Config

Options Type Default Description
animate boolean false Flag on whether to animate transition or not if possible.
latLng Wrld.LatLng * Location for the indoor map, defaults to indoor map entrance marker if visible.
distance number 400 The camera distance from the indoor map.
orientation number 0 Angle in degrees clockwise from north.

map.indoors.exit()

When viewing an indoor map, exits back to the exterior view.

map.indoors.getActiveIndoorMap()

Returns the IndoorMap currently being viewed, or null if not viewing an indoor map at all.

map.indoors.getFloor()

Returns an IndoorMapFloor representing the current floor of the active indoor map, or null if not viewing an indoor map.

map.indoors.setFloor(floor)

Sets the current floor to display within the active indoor map. Returns a boolean indicating whether the floor was successfully set.

Argument Type Description
floor IndoorMapFloor | string | number The floor to view, or the ID of that floor, or the index of that floor.

map.indoors.moveUp(numberOfFloors)

View a floor some number of floors above than the current floor.

Argument Type Description
numberOfFloors number How many floors to move up (1 by default).

map.indoors.moveDown(numberOfFloors)

View a floor some number of floors below than the current floor.

Argument Type Description
numberOfFloors number How many floors to move down (1 by default).

map.indoors.expand()

Transition to an expanded view of the indoor map, showing all floors.

map.indoors.collapse()

When expanded, transition back to the normal, collapsed view of an indoor map.

map.indoors.setFloorInterpolation(value)

When expanded, can be used to smoothly interpolate between the floors in view. A value of 0 will put the bottom floor in focus, while a value of 1 will put the top floor in focus.

Argument Type Description
value number An interpolation value between the bottom and top floors in the range 0..1.

map.indoors.getFloorInterpolation()

Returns the current floor interpolation value.

map.indoors.setFloorFromInterpolation(interpolationValue)

Sets the current floor based on some interpolation value by rounding to the nearest floor. Returns a boolean indicating success, as in setFloor().

Argument Type Description
interpolationValue number An interpolation value between the bottom and top floors in the range 0 to 1. Defaults to the current value of getFloorInterpolation().

map.indoors.setEntityHighlights(ids, color)

Highlights one or more indoor entities with the specified color and border thickness. Note: Border thickness only applies to area highlights.

Argument Type Description
ids string | string[] The id(s) of the entities.
highlightColor number[] The RGBA value of the highlight, stored in an array of numbers ranging from 0 to 255.
indoorId string The id of the indoor map which contains the entity ids. (Optional)
highlightBorderThickness number A value between 0 and 1 that describes how thick the border should be. Defaults to 0.5. (Optional)

map.indoors.clearEntityHighlights(ids)

Clears the highlights from one or more indoor entities. If no ids are specified then all highlighted entities will be cleared.

Argument Type Description
ids string | string[] The id(s) of the entities. (Optional)
indoorId string The id of the indoor map which contains the entity ids. (Optional)

map.indoors.tryGetReadableName(indoorMapId)

Returns the human-readable display name of an indoor map, or null if the value was unable to be obtained. Null may be returned if the specified indoor map is not currently loaded by the map streaming system.

Argument Type Description
indoorMapId string The id of the indoor map.

map.indoors.tryGetFloorReadableName(indoorMapId, indoorMapFloorId)

Returns the human-readable display name of an indoor map floor, or null if the value was unable to be obtained. Null may be returned if the specified indoor map is not currently loaded by the map streaming system, or if the specified floor id does not exist on that indoor map.

Argument Type Description
indoorMapId string The id of the indoor map.
indoorMapFloorId number The id of the indoor map floor.

map.indoors.tryGetFloorShortName(indoorMapId, indoorMapFloorId)

Returns the abbreviated human-readable display name of an indoor map floor, or null if the value was unable to be obtained. Null may be returned if the specified indoor map is not currently loaded by the map streaming system, or if the specified floor id does not exist on that indoor map.

Argument Type Description
indoorMapId string The id of the indoor map.
indoorMapFloorId number The id of the indoor map floor.

map.indoors.setBackgroundColor(backgroundColor)

Sets the color of the background overlay when displaying an indoor map.

Argument Type Default Description
backgroundColor string #000000c0 An Html hex color code, in the form #RRGGBB or #RRGGBBAA. Emmet-style abbreviations are also supported (#RGB and #RGBA).

Events

You can subscribe to events relating to indoor maps by using [events methods] on this object.

For example:

map.indoors.on("indoormapenter", function(e) {
    console.log("Entered an indoor map");
});

The following events are supported.

Event Data Description
indoormapenter IndoorMapEvent Fired when an IndoorMap is entered.
indoormapexit IndoorMapEvent Fired when an IndoorMap is exited.
indoormapfloorchange IndoorFloorEvent Fired when the IndoorMapFloor is set.
indoorentranceadd IndoorEntranceEvent Fired when an IndoorMapEntrance becomes available.
indoorentranceremove IndoorEntranceEvent Fired when an IndoorMapEntrance becomes unavailable.
expandstart Event Fired when an indoor map starts expanding. See map.indoors.expand().
expand Event Fired repeatedly while an indoor map is expanding.
expandend Event Fired when an indoor map stops expanding.
collapsestart Event Fired when an indoor map starts collapsing. See map.indoors.collapse().
collapse Event Fired repeatedly while an indoor map is collapsing.
collapseend Event Fired when an indoor map stops collapsing.
indoorentityclick Event Fired when an indoor entity is clicked.
indoormapenterrequested Event Fired when enter(indoorMap) is called.
indoormapload Event Fired when the map data streaming system loads an indoor map.
indoormapunload Event Fired when the map data streaming system unloads an indoor map.
indoormapenterfailed Event Fired when an IndoorMap enter request fails.
v1.1.0
Props Wrld.Prop
Themes Wrld.themes
Heatmaps Wrld.Heatmap
Events Event objects
Services (Optional) WrldPoiApi