Comments (5)
If you want to update radius with zoom level, you need to edit a couple methods. I actually experiment this idea a little bit and got some promising results.
First, I changed radius
function's signature and replaced r
with zoom
parameter.
radius: function (zoom, blur) {
blur = blur === undefined ? 15 : blur;
// recalculate radius based on zoom level
var r = this.defaultRadius * Math.pow(2, zoom - 15);
And updated draw method to accept current zoom level. I also made sure draw
method calls radius
method every time zoom
level is changed. Otherwise, radius
is called only once.
Here is a link to an example. It displays rectangles, not circles. You should be able to change it easily.
from leaflet.heat.
@zhuyinjing Sorry I don't remember which version was that, but you can just copy leaflet.heat code from https://jsfiddle.net/mertk/zawj9uwm/15/ and play with it.
from leaflet.heat.
Thanks @mertemin for the reply. Though I don't see the expected results but the radius does get recalculated on trying your logic. The intensities getting added up on zoom out is still blocking my expected result.
from leaflet.heat.
@mertemin hi,which version of leaflet.heat?3
And if i want to modify radius with different zoom level,can i use your code?
radius: function (zoom, blur) { blur = blur === undefined ? 15 : blur; // recalculate radius based on zoom level var r = this.defaultRadius * Math.pow(2, zoom - 15);
Is it need to modify the source code???
thanks you a lot!
from leaflet.heat.
thanks so much! @mertemin And i want to ask you. How can i modify this code?
does it need modify the source code?
Or add it to my code??
from leaflet.heat.
Related Issues (20)
- Heatmap with secret points
- IndexSizeError: Index or size is negative or greater than the allowed amount HOT 2
- maxZoom in leaflet HOT 2
- Need demo for adding heat using click
- Is it possible to change the intensity color based on the number of heatpoints combined in view? HOT 6
- Heatlayer radius over 80 creates strange object outside default heat HOT 1
- Layering different heat maps on top of eachother
- Crashes when container has 0 width/height HOT 2
- Zooming to bounds of points added. HOT 1
- How to add popup to heat points. HOT 1
- Crash on Firefox 72 on Mac (script is "blocked from extracting canvas data") HOT 7
- Laggy Heatmaps
- Demos don't work: Blocked loading mixed active content HOT 1
- ERROR: ENOENT: no such file or directory, open 'node_modules/simpleheat/simpleheat.js' HOT 1
- Not working offline HOT 1
- Uncaught TypeError: L.heatLayer is not a function HOT 2
- MaxOpacity HOT 2
- Intensity doesn't affect gradient HOT 1
- New npm release
- possible to add a legend ?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from leaflet.heat.