GithubHelp home page GithubHelp logo

Comments (5)

mertemin avatar mertemin commented on May 28, 2024 1

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.

mertemin avatar mertemin commented on May 28, 2024 1

@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.

cpunekar avatar cpunekar commented on May 28, 2024

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.

zhuyinjing avatar zhuyinjing commented on May 28, 2024

@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.

zhuyinjing avatar zhuyinjing commented on May 28, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.