Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Heatmap-leaflet not sure is working? ... #325

Open
themacboy opened this issue Aug 19, 2020 · 1 comment
Open

Heatmap-leaflet not sure is working? ... #325

themacboy opened this issue Aug 19, 2020 · 1 comment

Comments

@themacboy
Copy link

themacboy commented Aug 19, 2020

Good morning,

I am looking at all the examples in order to make an accident map of my city, but there's no way to show the heatmap in my leaflet map (last version).

For some reason I create the HeatmapOverlay, set all parameters, load all data, but nothing is showed.

I don't see any reason for that behavior then I like to know if that plug-in is still working.

CODE (basic implementation code):

let pl_Cal_ly_calor = new HeatmapOverlay({
radius: 20,
maxOpacity: .9,
blur: .75,
scaleRadius: true,
useLocalExtrema: true,
latField: "lat",
lngField: "lng",
valueField: "value"
})

mymap.addLayer(pl_Cal_ly_calor)

let testData = {max: 100, data: [{lat: 41.72950, lng: 1.83130, value: 100}]}
pl_Cal_ly_calor.setData( testData )

@themacboy themacboy changed the title Heatmap-leaflet not sure if it is working ... Heatmap-leaflet not sure is working? ... Aug 19, 2020
@shenzhuxi
Copy link

shenzhuxi commented Apr 25, 2022

https://github.com/pa7/heatmap.js/blob/master/plugins/leaflet-heatmap/leaflet-heatmap.js#L184
Although it's said "experimential... not ready.", it is actually working but setData not.

I can set the max value and draw the points like this:

    layer.setData({max:200, data:[]});
    layer.addData(data.data);

As a Leaflet Layer extension, I think addData should simply wrap https://github.com/pa7/heatmap.js/blob/develop/src/data.js#L123 and setData should be replaced by a function like setStyle for updating the options where max and min also belong to.

BTW, if you use "scaleRadius: true", you may need to zoom to see the huge rendering. #273

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants