Heatmap - How to scale weight, threshold and radius from zoom?
See original GitHub issueHello, I tried to update the weight of my heat map when the zoom level changes. But it seems to be to much and all is freezing. My data is a around 3000 positions. Here is my layer’s code :
new HeatmapLayer({
data,
id: 'heatmap-layer',
visible: true,
pickable: false,
colorRange: [
[185, 16, 224, 0],
[185, 16, 224, 25],
[185, 16, 224, 38],
[185, 16, 224, 64],
[185, 16, 224, 102],
[185, 16, 224, 127]
],
getPosition: d => [d.lng, d.lat],
getWeight: d => (zoom === 0 ? 0 : (zoom * 1) / 22),
radiusPixels: 40,
intensity: 1,
threshold: 0.2,
updateTriggers: {
getWeight: [zoom]
}
})
Is there an efficient way to update the weight, threshold and radius property when the zoom level changes?
Thanks a lot for your help!
Issue Analytics
- State:
- Created 3 years ago
- Comments:7
Top Results From Across the Web
Heat map symbology—ArcGIS Pro | Documentation
The radius is a set distance specified in screen unit points. Optionally, choose an attribute field with numeric data for Weight field to...
Read more >Heatmap weight change on zoom-out event? - Stack Overflow
I worked this out as follows: function getHeatMapRadius(latitudeCoordinate) { var distanceInMeter = 3; /* meter distance in real world */ var meterPerPixel ...
Read more >Add a heat map layer to a map - Azure - Microsoft Learn
Use a zoom expression to scale the radius for each zoom level, such that each data point covers the same physical area of...
Read more >Heatmap Layer | Maps JavaScript API - Google Developers
dissipating : Specifies whether heatmaps dissipate on zoom. · gradient : The color gradient of the heatmap, specified as an array of CSS...
Read more >Introducing heatmaps in Mapbox GL JS | by Vladimir Agafonkin
This property allows you to adjust the intensity of the heatmap appearance globally. The higher the value, the more “weight” each point will ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Looks like the update is not denounced if you change
radiusPixels
during zoom. I will investigate.@Pessimistress Perfect! The debounce works perfectly. Thanks a lot for your help and the job you do. Congrats to all the team!