Function slippy_map_tilenames::zoom_out
[−]
[src]
pub fn zoom_out(x: u32, y: u32) -> (u32, u32)
Zooms out starting from the given tile
The zoom out
function, given a tile t:(x, y)
corresponding to the zoomlevel z
,
returns the tile t_out
into which the tile t
is merged when zooming to the previous
zoomlevel z - 1
.
The actual zoomlevel is of no consequence to the function, since when zooming in the tile
t_out
will be split out into 4 tiles, one of which is in fact the present tile t
,
as per the definitions of a web slippy map.
For more info, cf. the relevant article in wiki.openstreetmap.org
Refer also to the Output
section of the zoom_in
function.
Arguments
x
- X current tile coordinatey
- Y current tile coordinate
Notice how the zoomlevel is unimportant, and therefore not needed as argument, since many tile's X and Y coordinates are shared among many different zoomlevels.
Examples
extern crate slippy_map_tilenames as smt; fn main() { let ((a1, b1), (c1, d1), (a2, b2), (c2, d2)) = smt::zoom_in(1,1); println!("+------+------+"); println!("| {}, {} | {}, {} |", a1, b1, c1, d1 ); println!("+------+------+"); println!("| {}, {} | {}, {} |", a2, b2, c2, d2 ); println!("+------+------+"); }
Unexpected Behavior
This function does not behave unexpectedly. However care should be taken in providing the tile's coordinates in input, since many tile's X and Y coordinates are shared among many different zoomlevels.
Cf. the following limit case, where zooming out from the tile (0, 0) only obtains the same tile (0, 0):
extern crate slippy_map_tilenames as smt; assert_eq!(smt::zoom_out(0, 0), (0, 0));