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([
[50.5, 30.5, 0.2], // lat, lng, intensity
[50.6, 30.4, 0.5],
...
], {radius: 25}).addTo(map);
To include the plugin, just use leaflet-heat.js
from the dist
folder:
<script src="https://github.com/Leaflet/Leaflet.heat/raw/gh-pages/leaflet-heat.js"></script>
To build the dist files run:
npm install && npm run prepublish
Constructs a heatmap layer given an array of points and an object with the following options:
maxZoom
of the map by default1.0
by default25
by default15
by default{0.4: 'blue', 0.65: 'lime', 1: 'red'}
Each point in the input array can be either an array like [50.5, 30.5, 0.5]
,
or a Leaflet LatLng object.
Optional third argument in each LatLng
point (altitude
) represents point intensity.
Unless max
option is specified, intensity should range between 0.0
and 1.0
.
max
option.minOpacity
option.addLatLng
, setLatlngs
, setOptions
and redraw
methods.max
option and support for different point intensity values (through LatLng
third argument).gradient
option to customize colors.