uber / h3-js

h3-js provides a JavaScript version of H3, a hexagon-based geospatial indexing system.
https://uber.github.io/h3
Apache License 2.0
874 stars 79 forks source link

Inconsistent results from polyfill after calling polyfill with complex polygon crossing antimeridian #103

Closed pugsley closed 3 years ago

pugsley commented 4 years ago

It seems that calling polyfill with a complex polygon (that crosses the antimeridian) messes with the h3 internals somehow, causing subsequent calls to return incorrect results.

This is best demonstrated by this jsfiddle: https://jsfiddle.net/tamaxerra/kxz865m7/1/

The console output from the fiddle is the number of h3 indexes returned:

36
56
27

The first (36) and last (27) count are the result of the same polygon being passed.

nrabinowitz commented 4 years ago

I can reproduce this in Observable as well, though it's less deterministic 😢. Cannot repro in h3-py, which makes me think this is JS-specific, probably due to something in Emscripten. Will investigate.

nrabinowitz commented 3 years ago

Thanks for bringing this up! This was a problem with the JS binding, fix currrently in review.

pugsley commented 3 years ago

Thanks, really appreciate the speedy fix! 👍

nrabinowitz commented 3 years ago

Thank you for the easy repro scenario! This would have been very difficult to debug without a deterministic reproduction.