H3 hexagons not matching

2.1k views Asked by At

I'm trying to use the polyfill function with the Python's h3 implementation, but I'm recieving unexpected results.

If I use the function with fixed resolution, I can get and show a polygon grid as shown above. enter image description here

But when I want to create a grid with more precision, like the grid that Uber made for the documentation:

enter image description here

I'm getting strange results.

I've created the grid with the same method as before, but with more precision (12), and then used the compact function to group the hexagons as possible.

hexagons = h3.polyfill(json_poly, 8, False)
hex_com = h3.compact(hexagons)

Te result is this, where I can see some areas that are not covered by any hexagon.

enter image description here

Any clue on why is happening this?

Is there something wrong with the methodology I'm using?

1

There are 1 answers

1
nrabinowitz On

See the answers here: https://github.com/uber/h3-js/issues/99#issuecomment-710659522

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.

In general, you'll want to use a fixed-resolution representation of your data unless you're compressing it for a particular reason.