I currently have a working leaflet map and would like to use the leaflet plugin Heatmap.js on top of this. http://www.patrick-wied.at/static/heatmapjs/example-heatmap-leaflet.html
The code I am using is very similar to the example in the above link.
var testData = {
max: 8,
data: [{lat: 24.6408, lng:46.7728, radius:500, count: 3}]
};
var cfg = {
"radius": 2,
"maxOpacity": 8,
"scaleRadius": true,
"useLocalExtrema": true,
latField: 'lat',
lngField: 'lng',
valueField: 'count'
};
var heatmapLayer = new HeatmapOverlay(cfg);
map.addLayer(heatmapLayer);
heatmapLayer.setData(testData);
When I run the map I don't see any sign of the heat map. Then when I pan around the map I get the following error in the console:
Failed to execute 'getImageData' on 'CanvasRenderingContext2D': The source height is 0.
Any idea how to resolve this? The demo on the heatmap.js website works great with almost identical code.
Thanks!
EDIT:
I have found where the error may be orginating from. Line 316 in heatmap.js is:
this._height = canvas.height = shadowCanvas.height = +(computed.height.replace(/px/,''));
Height is being returned as zero. Width is being set correctly however.