Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About Handling Error in cellsToMultiPolygon #158

Open
seajung opened this issue Nov 11, 2024 · 1 comment
Open

About Handling Error in cellsToMultiPolygon #158

seajung opened this issue Nov 11, 2024 · 1 comment

Comments

@seajung
Copy link

seajung commented Nov 11, 2024

I discovered that when using the cellsToMultiPolygon method, a SIGSEGV error can occur if there are duplicate indices in the input array. And this issue was addressed in a recent bug fix.

However, since the cellsToLinkedMultiPolygon method is designed to take a set as input, i think it would be beneficial to add a pre-processing step to ensure the input array has unique elements before calling h3Api.cellsToLinkedMultiPolygon.

Alternatively, there should be at least a comment in the code indicating that the input array must contain unique elements. Additionally, it would be helpful to specify an error code for the H3Exception, as it currently returns only 1.

It was really hard for me to find out the reason for the error 😭

@luneo7
Copy link
Contributor

luneo7 commented Nov 12, 2024

Changing the signature of cellsToMultiPolygon(Collection<Long> h3, boolean geoJson) to cellsToMultiPolygon(Set<Long> h3, boolean geoJson) will enforce it to not have duplicates, as per definition a set doesn't contain duplicates, and not further change is required in the H3Core to deduplicate anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants