GithubHelp home page GithubHelp logo

Hexbin some data about h3 HOT 3 CLOSED

uber avatar uber commented on May 16, 2024
Hexbin some data

from h3.

Comments (3)

dfellis avatar dfellis commented on May 16, 2024 1

If I've got your question right, I think you want to use the polyfill function (along with the maxPolyfillSize function to allocate the required memory). It takes a GeoJSON-like struct defining the area to fill, and it guarantees perfectly contiguous geometries have no overlapping hexagons (though the hexagons themselves may overlap the geometries, each overlapping hexagon will be in one or the other geofence, never both).

The bindings (that @isaacbrodsky is working on getting open sourced hopefully this month) handled the GeoJSON to GeoJSON-like struct conversion for you.

After that, you would just take the value for the zip code geofence and divide it equally amongst the hexagons in the polyfilled zip code hexagon array.

(EDIT: Hopefully the docs are pushed up soon so I don't have to link to source code directly for long. :) Also "polyfill" in this case is short for "polygon fill", and not the kind of polyfill common in Javascript.)

from h3.

jogly avatar jogly commented on May 16, 2024 1

+1 to @dfellis 's answer. only caveat i can see is for his solution alone, there isn't any weighted distribution possible for hexagons that have geometry overlapping a polygon boundary because they'll be assigned one side or another, like he said.

so for the portion of your question "taking into account degree of overlapping", you might have to implement post-processing with a degree of sophistication appropriate for your use case.

depending on your use case, you could avoid that by using sufficiently high resolution hexagon cells and stick with @dfellis's solution :)

from h3.

nrabinowitz avatar nrabinowitz commented on May 16, 2024

Closing this as resolved, please reopen if the answers here have any issues.

from h3.

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.