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

Can't change MAX_LEVEL globally #29

Open
kyr0 opened this issue Mar 11, 2022 · 1 comment
Open

Can't change MAX_LEVEL globally #29

kyr0 opened this issue Mar 11, 2022 · 1 comment

Comments

@kyr0
Copy link

kyr0 commented Mar 11, 2022

Hi,

thank you for the lib! There is a little problem with the levels. I wanted to have a shorter token to be generated per cell. I'm storing the tokens in a highly optimized and compressed DB. Every byte counts. Therefore lower level for "encoding" is desired for having shorter token based on lower subdivision precision.

This would be possible with e.g.:

S2.MAX_LEVEL = 10
S2CellId.MAX_LEVEL = 10

However, there is the S2Cell which has private static MAX_CELL_SIZE that defines:

MAX_CELL_SIZE = 1 << S2CellId.MAX_LEVEL;

I can't change this because it's private static and therefore all subsequent calculations fail.

I'd like to do:

S2Cell.MAX_CELL_SIZE = 1 << S2CellId.MAX_LEVEL;

And have a Utils helper method for setting so; I'd PR - but this repo seems unmaintained? :)

@vekexasia @rh389 @andrezsanchez ?

@vekexasia
Copy link
Owner

Hello @kyr0, although i'd like to keep this repo as equal to the google's implementation if there is a real reason and use-case where this could help i am not against it as long as it's documented in the READMe section.

As per the "unmaintained" yes, it was at least. It seems the library gained traction recently (unknown reasons to me) and therefore i will maintain it to the best of my free-time and capabilities for those who encounter bugs and stuff.

That being said, if you'd like to provide a merge request. I'll be more than happy to review it and merge it.

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