Radius with respect to zoom level
See original GitHub issue@mourner Is it possible to change the radius based on zoom level. For eg. if I zoom out, the radius of a lat/lng should decrease and if we zoom in the radius should increase, but keeping the allocated intensity value to the given lat/lng value and not adding up the intensities on zoom out.
I tried to modify the draw() function but it doesnt work. The radius() function just gets called once upon initialization, I tried to call it on each zoom in/ out activity from redraw() but it doesn’t work, following is the sample code of what I am trying to achieve:
draw: function(t) {
this._ctx.canvas.height = this._ctx.canvas.height + (this._r * 10);
this._ctx.canvas.width = this._ctx.canvas.width + (this._r * 10);
this._circle || this.radius(this.defaultRadius), this._grad || this.gradient(this.defaultGradient);
The canvas draw fails to plot the points on the map.
Issue Analytics
- State:
- Created 7 years ago
- Comments:5
Top Results From Across the Web
What is the mathematical relationship between Radius ...
MIN ZOOM = 1 MAX ZOOM = 22 R = radius of the circle that have center in the position get from the...
Read more >Make circles radius react to zoom level - Stack Overflow
I tried this code but I really can't explain the results. What happens is that every time I zoom in or out, the...
Read more >Zoom levels - - OpenStreetMap Wiki
Level # Tiles Tile width (° of longitudes) m / pixel (on Equator) ~ Scale (on screen)
00 000 000 000 001 360.0000 156...
Read more >[Google Maps API v3] How can I set the zoom level based on ...
You can use Circle() as a helper to avoid maths. Create an instance of Circle() with 25 miles radius. var circle = new...
Read more >zoom - CSS: Cascading Style Sheets - MDN Web Docs
The non-standard zoom CSS property can be used to control the magnification level of an element. transform: scale() should be used instead ...
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
@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.
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 replacedr
withzoom
parameter.And updated draw method to accept current zoom level. I also made sure
draw
method callsradius
method every timezoom
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.