GithubHelp home page GithubHelp logo

Comments (3)

nrabinowitz avatar nrabinowitz commented on September 28, 2024

I think there's some confusion here about the nature of compact. The compact algorithm is essentially a data compression algorithm - it represents the compacted set in a compressed form, and can be used for efficient data storage/transfer of large areas, some lookup algorithms, etc. But the cells in the compacted set do not cover the area of the uncompacted set, as your image shows, because of the imperfect hierarchical containment of a hexagon-based grid system.

Whether and how this matters depends on your use case. If you want to see the exact area covered by the compacted set, you need to uncompact it, so compact is not a good optimization for display. But it can be very useful for data transfer, reducing memory consumption, and some lookup operations.

from h3-js.

dfellis avatar dfellis commented on September 28, 2024

There is another way to look at it :) We could consider only the Resolution 15 hexagons "true hexagons" and then Resolution 14 is collections of 7 hexagons packed together to looked approximately like the hexagon we render/present, and Resolution 13 is then 49 resolution 15 hexagons packed together, etc.

This perspective will produce perfectly contiguous compacted sets, but the boundaries of the hexagons above Resolution 15 are not truly hexagonal, but fractal approximations of hexagons.

This perspective is not actually supported by H3 at this time, since it's esoteric and confusing, and I can't think of any valid reason why you'd want it, except if you don't care about the shape of the hexagon and just want hexagon-ish shapes that perfectly subdivided like S2 cells perfectly subdivide. The only niche I can think of that would desire this is something that still wants k-ring style quasi-circular fast lookup, singular class of neighbors (all neighbors being equidistant from each other as measured by their centerpoints), and perfect subdivision for rapidly and accurately re-indexing between resolutions when some density threshold is reached.

But anyone needing those qualities can simply index always at res 15 and then simply truncate the lower bits to the desired resolution.

With respect to the visualization above, though, I would recommend uncompacting the set before displaying it, or mapping each hexagon via h3ToChildren to the minimum size and then h3SetToMultiPolygon to get GeoJSON in the fractally-hexagonal shapes mentioned above and then rendering those if keeping the "compactness" of the data present in the visualization is desired.

from h3-js.

mikecolonna avatar mikecolonna commented on September 28, 2024

Thanks @nrabinowitz @dfellis! Your insights have been very helpful. For our use case, we're going to move forward with using an uncompacted set of hexagons at resolution 10 for now, so as to minimize eng lift and ensure the entire area is covered. If this turns out not to be sufficient, we'll investigate higher resolutions and use compact as a way to compress these hexes across our pipelines.

from h3-js.

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.