uber / uber/h3-java

polygonToCells fails on a rectangular polygon

Open
#138 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
333
Forks
68
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure with H3Core.newInstance().polygonToCells using the rectangular coordinates and resolution 10 from the issue. Compare the same polygon at latitude 63 and inspect the Java binding and underlying H3 behavior for this latitude. Done means the reported polygon no longer throws H3Exception, with the regression covered by a test if the relevant test location is identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.