Skip to content


Are tokens ordered? #34

tmcw opened this Issue · 2 comments

2 participants

Mapbox member

@morganherlocker want to try this out?

So: is the output of cellid.totoken ordered - as in, rangeMin and rangeMax will correctly compare as strings?

This is important because we need an index encoding that easily supports range queries.

Mapbox member

Yes, they appear to be. I went in a line and gathered up a few of the tokens, and they were ordered alphanumerically.

screenshot 2014-07-16 12 59 00

screenshot 2014-07-16 12 55 27

I went 4 cells west => east, but I believe it should follow the ordering of the hilburt curve across more cells. I will take a look to verify this. I think that the ordering should be like this:


Mapbox member

Ok, they are definitely ordered, and everything looks good. The indexes follow a hilburt curve, and lower zoom cells have a truncated hash of the higher zoom cells, so ranges should work across zoom levels.

screenshot 2014-07-16 17 04 45
screenshot 2014-07-16 17 36 11

screenshot 2014-07-16 17 11 39

fyi: here is the code:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.