Comments (3)
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.
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.
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)
- Openlayers instead of Mapbox HOT 1
- Count the number of points in the aggregated bins of H3-hexagons HOT 3
- Upgrade emscripten to 3.X.X? HOT 7
- Integrating with google maps HOT 1
- How to replace firestore geofire with h3? HOT 3
- Potential memory leak in polygonToCells HOT 10
- Load and Display H3-JS binned dataset in Mapbox HOT 1
- Consider buffer radius in addition to H3 resolution when counting points in the aggregated bins of H3-hexagons HOT 2
- Inverted coordinates HOT 1
- H3-JS binning resoluion in OpenLayers HOT 1
- Incorrect result from polygonToCells for bigger screen/ higher dimensions HOT 6
- Error when passing zero area polygon to h3.polygonToCells HOT 2
- Does h3-js send any data to the server? HOT 1
- I am unable to load h3-JS in my quasar project HOT 3
- H3 with dynamodb
- Different output from h3-js and postgis using cellToBoundary function HOT 1
- Hexagons Resolution HOT 1
- Somthing is funky at the borders of the cells HOT 1
- Novice h3-js lib installation issue HOT 1
- polygonToCells fails for some simple large polygons HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from h3-js.