Leaflet/Leaflet.heat
Leaflet/Leaflet.heat has 1,663 GitHub stars and 522 forks. GitHot measured +2 stars in 24 hours and +4 in 7 days. Last checked 2026-11-10 01:24 UTC. Last push 2024-06-28.
A tiny, simple and fast heatmap plugin for Leaflet.
Measured star growth
- in 24h
- +2
- in 7 days
- +4
- in 15 days
- Update delayed
- in 1 month
- Update delayed
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.md
OriginalLeaflet.heat
A tiny, simple and fast Leaflet heatmap plugin. Uses simpleheat under the hood, additionally clustering points into a grid for performance.
Demos
Basic Usage
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="leaflet-heat.js"></script>
Building
To build the dist files run:
npm install && npm run prepublish
Reference
L.heatLayer(latlngs, options)
Constructs a heatmap layer given an array of points and an object with the following options:
- minOpacity - the minimum opacity the heat will start at
- maxZoom - zoom level where the points reach maximum intensity (as intensity scales with zoom),
equals
maxZoomof the map by default - max - maximum point intensity,
1.0by default - radius - radius of each "point" of the heatmap,
25by default - blur - amount of blur,
15by default - gradient - color gradient config, e.g.
{0.4: 'blue', 0.65: 'lime', 1: 'red'} - pane - Map pane where the heat will be drawn. Defaults to 'overlayPane'.
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.
Methods
- 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.
Changelog
0.2.0 — Oct 26, 2015
- Fixed intensity to work properly with
maxoption. - Fixed zoom animation on Leaflet 1.0 beta 2.
- Fixed tiles and point intensity in demos.
0.1.3 — Nov 25, 2015
- Fixed some edge cases when handling point intensity.
- Added
minOpacityoption.
0.1.2 — Nov 5, 2014
- Added compatibility with Leaflet 0.8-dev.
0.1.1 — Apr 22, 2014
- Fixed overlaying two heatmaps on top of each other.
- Fixed rare animation issues.
0.1.0 — Feb 3, 2014
- Added
addLatLng,setLatlngs,setOptionsandredrawmethods. - Added
maxoption and support for different point intensity values (throughLatLngthird argument). - Added
gradientoption to customize colors.
0.0.1 — Jan 31, 2014
- Initial release.
Explore related projects
codecrafters-io/build-your-own-x
Master programming by recreating your favorite technologies from scratch.
561,398 starspublic-apis/public-apis
A collective list of free APIs
497,679 starsmorluto/rea
Reverse engineer anything with agents, from app behavior down to native binaries.
447,495 starsopenclaw/openclaw
The AI that really does things. Any OS. Any Platform. The lobster way. 🦞
394,261 stars