Skip to content

Can't change MAX_LEVEL globally #29

Description

@kyr0

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 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions