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.
But when I want to create a grid with more precision, like the grid that Uber made for the documentation:
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.
Any clue on why is happening this?
Is there something wrong with the methodology I'm using?
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.