GithubHelp home page GithubHelp logo

hexgridheatmap's People

Contributors

kronick avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

hexgridheatmap's Issues

Heatmap based on values instead density

I love the library and would like to make a feature request to build a heatmap from values. Here a superior argument from somebody else (from mapbox/mapbox-gl-js#4756):

by default, heatmaps render according to point density (so two points in the same spot are twice as intense as one). But there are cases where we want a different behavior โ€” imagine an air pollution map that shows measurements from spots around the country. Multiple measure points clustered close together shouldn't cause the area to appear many times more polluted compared to an area with the same pollution but only one measure spot.[...]

I can imagine it would work like this:

    var heatmap = new HexgridHeatmap(map, "hexgrid-heatmap", "waterway-label");
    heatmap.setType('value'); // or 'density' which is default
    heatmap.setWeightProperty('airPollutionLevel'); // a property in each Feature of the FeatureCollection
    heatmap.setReduceFunction('mean'); // 'median' or even a function which accepts values

    //normal init from before
    heatmap.setIntensity(6);
    heatmap.setSpread(0.15); //
    heatmap.setCellDensity(0.5); // small value == bigger hexagons
    heatmap.setData(berlinData);
    heatmap.update();

I assume clustering logic would need little or no changing, but instead of counting all objects are iterated through, the value from the property extracted and the reduce function called.

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.