> For the complete documentation index, see [llms.txt](https://docs.mapsindoors.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mapsindoors.com/sdks-and-frameworks/android/display-heatmap-overlay.md).

# Display Heatmap Overlay

Android V4

If you use Mapbox as your map provider, it provides the option of creating a heatmap as an alternative way to display datapoints on your map. The MapsIndoors SDK also provides support for integrating this heatmap into the MapsIndoors layers.

### Creating a heatmap​ <a href="#creating-a-heatmap" id="creating-a-heatmap"></a>

This guide will focus on how to display the heatmap layer in a visually pleasing way in your MapsIndoors solution. In order to actually create your heatmap, please refer to the documentation from Mapbox themselves.

* Creating a heatmap with Mapbox: <https://docs.mapbox.com/help/tutorials/make-a-heatmap-with-mapbox-gl-js/>
* Creating a heatmap layer with Mapbox: <https://docs.mapbox.com/mapbox-gl-js/example/heatmap-layer/>

### Inserting the heatmap layer between MapsIndoors layers​ <a href="#inserting-the-heatmap-layer-between-mapsindoors-layers" id="inserting-the-heatmap-layer-between-mapsindoors-layers"></a>

Once you have created your heatmaps with your map provider, you will need a way to get it to work with the layers that MapsIndoors already applies to your Mapbox map. By following the above guides, you should be able to simply overlay it on top of everything. But in order for it to be integrated more seamlessly in the MapsIndoors layers, you could also choose to insert between the tile layer and the layer containing the area polygons.

> This will only work with Android SDK v4.0.1 and newer.

To achieve this you will use the MapsIndoors `Layers` class that comes with the Mapsindoors Mapbox dependency. It can be done like this:

```kotlin
mapboxMap.getStyle { style ->
    style.addLayerBelow(createHeatmapLayer(), Layers.AREA_FILL)
}
```

`Layers.AREA_FILL` is the lowest of the MapsIndoors layers (except for tiles, but as that is changed depending on floor indexes, it is not available through the SDK). This means the heatmap will be rendered above tiles, but underneath any other MapsIndoors-specific item on the map.

```kotlin
mapboxMap.getStyle { style ->
    style.addLayerBelow(createHeatmapLayer(), MPLayers.POI)
}
```

`Layers.POI` is the Location marker layer of the MapsIndoors layers. This means the heatmap will be rendered on top of markers, but below the positioning dot ("blue dot") and route markers.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.mapsindoors.com/sdks-and-frameworks/android/display-heatmap-overlay.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
