8000 Encode "extra" information in unused digits of H3 indexes by isaacbrodsky · Pull Request #1025 · uber/h3 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Encode "extra" information in unused digits of H3 indexes #1025

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

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

isaacbrodsky
Copy link
Collaborator

No description provided.

@ajfriend
Copy link
Contributor
ajfriend commented Jul 2, 2025

Do we need a separate function for unused digits? I'd be happy with general setDigit and getDigit functions, and leave the used/unused logic up to the user.

And we'd also probably want setResolution and setBaseCell functions, right? Or is the use case you're thinking of here specifically around "extra" information in the unused bits?

@isaacbrodsky
Copy link
Collaborator Author

Do we need a separate function for unused digits? I'd be happy with general setDigit and getDigit functions, and leave the used/unused logic up to the user.

I think it is helpful to have specific functions for this. setDigit doesn't make much sense to modify a standard index, because if you're doing that you are already in the details of H3 so much that modifying the index is the simplest part. This supports users that want to take advantage of the additional bits without getting into details of how precisely that works.

Another value of separate functions here is that they can guide the user how to use the "extra" information. It surfaces that this is something that can actually be done with the indexes because it's a top-level API, it guides the user what the range of valid values to encode are (not obvious without computing the mask), and single-function-call encoding of that data (important for e.g. SQL where multiple H3 API calls is tricky.)

And we'd also probably want setResolution and setBaseCell functions, right? Or is the use case you're thinking of here specifically around "extra" information in the unused bits?

I am thinking specifically of the "extra" information. I don't think setBaseCell makes sense as a function because again, if you need to set the base cell on an index, actually modifying the integer seems like the simplest part of whatever you're doing, so the library helping you do it isn't that useful.

@isaacbrodsky isaacbrodsky changed the title Unused digits Encode "extra" information in unused digits of H3 indexes Jul 2, 2025
@ajfriend
Copy link
Contributor
ajfriend commented Jul 2, 2025

Makes sense for this to focus just on the unused bits. I'm just wondering, though, have we seen many use cases for this in the past? Or what use cases do you have in mind?

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

Successfully merging this pull request may close these issues.

2 participants
0