Heatmap
The android-heatmap module provides a map-implementation-agnostic heatmap overlay for MapConductor.
It renders heatmap data as a tile-based raster layer and works with any map provider (Google Maps, MapLibre, Mapbox, ArcGIS, HERE, etc.).
Installation
Section titled “Installation”dependencies { implementation(platform("com.mapconductor:mapconductor-bom:1.1.3")) implementation("com.mapconductor:core") implementation("com.mapconductor:heatmap")
// Choose your map provider implementation("com.mapconductor:for-googlemaps")}Basic Usage
Section titled “Basic Usage”Place HeatmapOverlay inside any XxxMapView content block and add points with HeatmapPoint:
XxxMapView(...) { HeatmapOverlay( radiusPx = 20, opacity = 0.7, ) { HeatmapPoint( position = GeoPoint(latitude = 35.6762, longitude = 139.6503), weight = 1.0, ) HeatmapPoint( position = GeoPoint(latitude = 35.6895, longitude = 139.6917), weight = 2.5, ) }}Batch Points
Section titled “Batch Points”For large datasets, use HeatmapPoints to add all points in a single update:
val pointStates: List<HeatmapPointState> = remember { buildPointList() }
XxxMapView(...) { HeatmapOverlay(radiusPx = 20) { HeatmapPoints(pointStates) }}Dynamic State
Section titled “Dynamic State”Use HeatmapOverlayState to control heatmap properties at runtime:
val heatmapState = remember { HeatmapOverlayState( radiusPx = 20, opacity = 0.7, gradient = HeatmapGradient.DEFAULT, )}
// Update dynamicallyheatmapState.radiusPx = 30heatmapState.opacity = 0.5
XxxMapView(...) { HeatmapOverlay(state = heatmapState) { HeatmapPoints(pointStates) }}Custom Gradient
Section titled “Custom Gradient”val gradient = HeatmapGradient( listOf( HeatmapGradientStop(position = 0.0, color = Color.argb(0, 0, 0, 255)), HeatmapGradientStop(position = 0.5, color = Color.rgb(0, 255, 0)), HeatmapGradientStop(position = 1.0, color = Color.rgb(255, 0, 0)), ))
val heatmapState = remember { HeatmapOverlayState(gradient = gradient)}API Reference
Section titled “API Reference”HeatmapOverlay
Section titled “HeatmapOverlay”| Parameter | Type | Default | Description |
|---|---|---|---|
radiusPx | Int | 20 | Blur radius of each point in pixels |
opacity | Double | 0.7 | Layer opacity (0.0–1.0) |
gradient | HeatmapGradient | HeatmapGradient.DEFAULT | Color gradient |
maxIntensity | Double? | null | Max intensity for normalization; auto-calculated if null |
HeatmapOverlayState
Section titled “HeatmapOverlayState”| Property | Type | Default |
|---|---|---|
radiusPx | Int | 20 |
opacity | Double | 0.7 |
gradient | HeatmapGradient | HeatmapGradient.DEFAULT |
maxIntensity | Double? | null |
weightProvider | (HeatmapPointState) -> Double | { it.weight } |
HeatmapGradient.DEFAULT
Section titled “HeatmapGradient.DEFAULT”Green (#66E100) at position 0.2 → Red (#FF0000) at position 1.0.