Have a way to determine total number of tiles, min/max x,y coordinates on fixed zoom level
daniel-j-h opened this issue ยท 0 comments
Hey hey ๐ I'm stumbling over this use case every now and then and wanted to share.
It would be great to have easy ways to get the total number of tiles on a fixed zoom level, and the xmin, xmax, ymin, ymax for fixed zoom level z.
Why is this interesting? For example if you have quadkeys / tiles on a zoom level and want to feed the geo-referencing information to a model. Then one way is to normalize the tile's x and y coordinates into [-1, 1]
e.g. via
[(t.x / (2**t.z - 1) * 2 - 1, t.y / (2**t.z - 1) * 2 - 1) for t in tiles]
and there is a total of 2**(2*10)
z10 tiles.
Note: you could also go from tile to lng, lat, and get that to [-1, 1]
but where's the fun in that ๐
It would be great to have small helpers for these zoom level based tile calculations; nothing blocking or urgent, just something coming up again and again, and I guess other folks would need it, too.
โ๏ธ