folium: HeatMap doesn't use weights

I spend quite some time tracking down this bug. I think it should be fixed or the limitation should be clearly stated in the docs. This is a major time waster and makes a bad impression on this otherwise great package.

This is a major bug coming for the upstream Leaflet.heat project.

Problem description

The plugins.HeatMap states that the points used to create the heat map can be weighted.

data (list of points of the form [lat, lng] or [lat, lng, weight])

However weights are simply ignored. This makes it useless for heatmaps that are based on a few points with different weights.

Expected Output

Weight should have impact. Or remove this option from the docs.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 23 (11 by maintainers)

Most upvoted comments

You can install folium with pip from the master branch like this: pip install git+https://github.com/python-visualization/folium.git

Note that you’re using v0.11.0 and we were talking about the master branch, which contains a fix for heatmaps and changes its behavior slightly. With the fix, max_val is deprecated.

Hi @ibayer , sorry to hear this bug caused you some issues. I opened a PR which applies a patch from the leaflet.heat repo. Can you perhaps help by testing the PR, see if it solves the issue for you?

Alternatively, if we don’t get a fix working, we should indeed update the documentation.