uber / h3

Hexagonal hierarchical geospatial indexing system
https://h3geo.org
Apache License 2.0
4.85k stars 459 forks source link

fix: handle compacting base cell children #679

Closed jogly closed 2 years ago

jogly commented 2 years ago

Children of a res 0 cell should compact back to that cell successfully.

isaacbrodsky commented 2 years ago

It looks like around h3Index.c line 344 it tries to take the parent of a res 0 cell at res -1 (res -1 was calculated on line 325), which is where the failure is coming from.

jogly commented 2 years ago

I'm uncertain of this solution, but it passes existing tests and the new failing test.

Basically if the compaction process reaches a base cell, we skip the parent reserved-bit-hit processing and move on to the rest of the logic.

coveralls commented 2 years ago

Coverage Status

Coverage increased (+0.001%) to 99.035% when pulling f125f68eb8d582bed896c6fb369eafdba7c40acf on jogly:gilley/test-compact-to-res0 into e5209fc714293008aeea5d7bd074d2ffd80d679b on uber:master.