deck.gl icon indicating copy to clipboard operation
deck.gl copied to clipboard

[Bug] Heatmap layer does not work for negative weights

Open lukeellison opened this issue 1 year ago • 0 comments

Description

There is no way to currently use the Heatmap layer with negative values for weights. Things I've tried:

  • Threshold: 0
  • Threshold: any negative number
  • ColorDomain: [negative numbers, postive numbers]

If you try the above the areas where the heatmap would have a negative value are cut off. Potentially it is calculating the right weight through the sum of the values but can't apply it to the colourRange correctly.

Flavors

  • [ ] Script tag
  • [X] React
  • [ ] Python/Jupyter notebook
  • [ ] MapboxOverlay
  • [ ] GoogleMapsOverlay
  • [ ] CartoLayer
  • [ ] ArcGIS

Expected Behavior

Very negative values appear at the bottom of the colorRange on the heatmap, very positive values at the top.

Steps to Reproduce

  1. Make a Heatmap layer over a map
  2. Have data points with negative weights at a position. e.g.
{
 lonlat: [1, 2],
 score: -0.5
}
  1. getWeight: d => d.score,
  2. observe

Environment

  • Framework version: "deck.gl": "^9.0.27",
  • Browser: Brave Version 1.66.115 Chromium: 125.0.6422.112 (Official Build) (arm64)
  • OS: Mac OS Version 14.0

Logs

No response

lukeellison avatar Aug 21 '24 17:08 lukeellison