5

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?

Pablo Pardo
  • 729
  • 5
  • 12
  • 26
  • Ok, Ive realized that the California map also have this gaps. Te question now is if is there any way to avoid, or fill this gaps. – Pablo Pardo Oct 16 '20 at 08:28
  • The issue, is simply you must use the same resolution when generating this. just use the same resolution for all hexagons. there is no way to fill the gaps – Jeryl Cook Mar 03 '21 at 21:21

1 Answers1

3

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.

nrabinowitz
  • 55,314
  • 10
  • 149
  • 165