Leaflet.heat icon indicating copy to clipboard operation
Leaflet.heat copied to clipboard

Can Leaflet.heat emulate the default Google visualization.HeatmapLayer ?

Open sheffieldnikki opened this issue 10 years ago • 2 comments

I have a map that uses Google Maps and their visualization.HeatmapLayer with the default colours, and radius=20:

http://racelifts.org/Highland-Fling-2014/stats

I'm trying to reproduce this as closely as I can with Leaflet and Leaflet.heat - colours, opacity, etc. I've experimented with radius, blur, maxZoom & gradient settings, but I can't get close :( Is it possible? Thanks

sheffieldnikki avatar May 16 '14 10:05 sheffieldnikki

I can't really tell how the original is built. If there are fixed contours and color levels, I don't think heat will work for you because it dynamically forms little clusters with a weight.

doomsuckle avatar May 16 '14 15:05 doomsuckle

i guess you should get the colours pretty close by fiddling with the gradient settings. for opacity: leaflet.heat uses simpleheat for drawing the actual heatmap. You can modify the colorization by editing the _colorize-function: https://github.com/mourner/simpleheat/blob/gh-pages/simpleheat.js#L126 There you could change the max-opacity to 0.6 by adding pixels[i] *= .6 right after line 133 pixels[i - 1] = gradient[j + 2]; You then have to replace the simpleheat-library which is included in leaflet.heat with your modified version.

schlompf avatar May 18 '14 09:05 schlompf