Skip to main content

visible_tiles

Function visible_tiles 

Source
pub fn visible_tiles(bounds: &WorldBounds, zoom: u8) -> Vec<TileId>
Expand description

Return all tiles that intersect the given world-space bounding box at a zoom level.

§Antimeridian handling

When the bounding box spans the antimeridian (min.x > max.x in world space after unprojection), the X iteration wraps around, producing tiles on both sides of the dateline. The Y range never wraps because latitude is bounded by the Mercator limit.

§Ordering and duplicates

Output is deterministic and row-major: y increases outermost, x advances left-to-right within each row (with wrap when needed). Each (z, x, y) appears at most once.

§Allocation

Returns an owned Vec with capacity pre-allocated from the tile count. At zoom 14 a typical viewport might produce ~200 tiles; at zoom 18 with a 4K display, up to ~4000.