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

Bug: Heat map created is not what one expects

Open achourasia opened this issue 8 years ago • 5 comments

There seems to be bug in heat map generation. For example there are five points with different weights and a defined color gradient. Expected output must be these points with different colors, yet the out shows same color for each point.

Below is the example code which generates incorrect output `var map = L.map('map').setView([43.46811941, -90.04569087], 5);

var tiles = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png').addTo(map);

addressPoints = [[42.35810000, -71.06360000, 10.3], [42.82995815, -74.78991444, 0.4], [43.17929819, -78.56603306, 0.5], [43.40320216, -82.37774519, 0.6], [43.49975489, -86.20965845, 0.7], [43.46811941, -90.04569087, 0.8],];

var heat = L.heatLayer(addressPoints, {minOpacity:1, blur:0, max: 1.0}).addTo(map);`

Please see the following fiddles Fiddle with incorrect output using heat_map.js: https://jsfiddle.net/y20js9nm/13/ Fiddle with correct output using heatmap.js: https://jsfiddle.net/pz4usuLe/40/ (had problems with loading external js) Fiddle with correct output using heatmap.js: https://jsfiddle.net/pz4usuLe/43/ (Fixed)

achourasia avatar Sep 02 '16 20:09 achourasia

Fixed the JS fiddle that shows correct output with heatmap.js https://jsfiddle.net/pz4usuLe/43/ The Javascript was not loading correctly. I suggest reopening this issue, as this seems to be major bug

achourasia avatar Oct 03 '16 18:10 achourasia

So what´s the recommended heatmap to be used?

ispmarin avatar Nov 22 '16 11:11 ispmarin

Hello, I am using heatmap plugin of folium and it is generating incorrect output by ignoring the weights of the locations. As I understand it is due to underlying js which is not loading correctly and ignoring weights. I will appreciate if someone can suggest a workaround. Thanks

aysunakarsu avatar Sep 09 '18 11:09 aysunakarsu

Any updates on this?

seblaz avatar Sep 17 '18 00:09 seblaz

Hello I'm using heatmap plugin of folium in python. And it is generating an incorrect map by ignoring the weights. How couldI fix this problem in Python?

DavidMaer avatar Feb 25 '19 06:02 DavidMaer