Highlight and Select

This documentation refers to the introduced concept of select and highlight that was released with SDK 4.3.0

How to change the appearance of different states

The state Display Rules controls how Locations are displayed on the map in different states. For example, you can change the icon scale of a Location when it is hovered over or highlight a search result. The state Display Rules gives access to the same properties as the regular Display Rules, which can be used to control the appearance of Locations.

The Android SDK supports Select and Highlight Display Rules these can be received and edited through MapsIndoors Example:

//Changing the visibility of a polygon for selection
MapsIndoors.getDisplayRule(MPSolutionDisplayRule.SELECTION)?.let {
    it.isPolygonVisible = true

//Changing the visibility of a label for highlights
MapsIndoors.getDisplayRule(MPSolutionDisplayRule.HIGHLIGHT)?.let {
    it.isLabelVisible = false


Highlight is for changing the appearance for a collection of MPLocation's, for example to highlight where the restrooms are located in an office building.

Highlight all Restrooms:

//Create a filter to only receive locations with the category Toilet
val filter = MPFilter.Builder().setCategories(Collections.singletonList("Toilet")).build()
//Query locations with the created filter
MapsIndoors.getLocationsAsync(null, filter) { locations, error ->
    if (locations != null) {
        //Highliting all current toilets, with default MPHighlightBehavior. 
        //The MPHighlightBehavior can be used to customize the camera and map behavior when applying it.
        //Like fitting the view to show all highlighted locations, if possible.
        mMapControl?.setHighlight(locations, MPHighlightBehavior.DEFAULT)

Clear the highlight



The selection Display Rule is for changing the appearance of a single Location, for example when the user clicks on it. To select a Location manually, call the MapControl.selectLocation(location: MPLocation, behavior: MPSelectionBehavior) method.

mMapControl?.selectLocation(location, MPSelectionBehavior.DEFAULT)

Clear current selection:


Previous selection

Before the release of 4.3.0 the Android SDK already had a visual implementation of selection with a Display Rule. This is the MPSolutionDisplayRule.SELECTION_HIGHLIGHT that can also be changed like the newly introduced MPSolutionDisplayRule. If you want to retain the old selection rendering, it can be toggled through the Solution Config on the SDK. Example:

MapsIndoors.load(application, "myapikey") { e: MIError? ->
    //This will work on any subsequent mapcontrol loads or previously loaded mapcontrols.
    MapsIndoors.getSolution()?.config?.isNewSelection = false

Note that this is based on the Solution, so with any subsequent load of MapsIndoors, it will be necessary to set the value to false again, as it defaults to true.

Last updated