uber / h3-java

Java bindings for H3, a hierarchical hexagonal geospatial indexing system
https://uber.github.io/h3/
Apache License 2.0
283 stars 54 forks source link

polygonToCells fails on a rectangular polygon #138

Open jogoussard opened 1 year ago

jogoussard commented 1 year ago

Hi Given this rectangular polygon

POLYGON((11.147991 64.75815699999998,11.443969 64.75815699999998,11.443969 64.845147,11.147991 64.845147,11.147991 64.75815699999998))

the polygonToCells call fails with

com.uber.h3core.exceptions.H3Exception: The operation failed but a more specific error is not available

Test program to reproduce:

    var coords = List.of(
        new LatLng(64.758157,11.147991),
        new LatLng(64.758157,11.443969),
        new LatLng(64.845147,11.443969),
        new LatLng(64.845147,11.147991),
        new LatLng(64.758157,11.147991));

    H3Core.newInstance().polygonToCells(coords, List.of(), 10);

The ''same'' polygon shifted at latitudes of 63 degrees works without issue.

Library version: com.uber:h3:4.1.1 OS: Mac Os Ventura 13.5 Processor: 2.6 GHz 6-Core Intel Core i7 Memory: 32GB

Any potential fix/workaround suggestion? Thanks a lot