A tiny, simple and fast Leaflet heatmap plugin. Uses simpleheat under the hood, additionally clustering points into a grid for performance.
var heat = L.heatLayer(latlngs, {radius: 25}).addTo(map);
To include the plugin, just use leaflet-heat.js
from the dist
folder:
<script src="leaflet-heat.js"></script>
Constructs a heatmap layer given an array of LatLng
points and an object with the following options:
- maxZoom - zoom level where the points reach maximum intensity (as intensity scales with zoom),
equals
maxZoom
of the map by default - max - maximum point intensity,
1.0
by default - radius - radius of each "point" of the heatmap,
25
by default - blur - amount of blur,
15
by default - gradient - color gradient config, e.g.
{0.4: 'blue', 0.65: 'lime', 1: 'red'}
Optional third argument in each LatLng
point (altitude
) represents point intensity.
- setOptions(options): Sets new heatmap options and redraws it.
- addLatLng(latlng): Adds a new point to the heatmap and redraws it.
- setLatLngs(latlngs): Resets heatmap data and redraws it.
- redraw(): Redraws the heatmap.
- Added
addLatLng
,setLatlngs
,setOptions
andredraw
methods. - Added
max
option and support for different point intensity values (throughLatLng
third argument). - Added
gradient
option to customize colors.
- Initial release.