pub struct Tile { /* private fields */ }Expand description
A single tile.
Implementations§
Source§impl Tile
impl Tile
Sourcepub fn new(zoom: u8, x: u32, y: u32) -> Option<Tile>
pub fn new(zoom: u8, x: u32, y: u32) -> Option<Tile>
Constucts a Tile with the following zoom, x and y values.
Returns None if the x/y are invalid for that zoom level, or if the zoom is >= 100.
§Examples
assert!(Tile::new(0, 3, 3).is_none());Sourcepub fn from_tms(tms: &str) -> Option<Tile>
pub fn from_tms(tms: &str) -> Option<Tile>
Constucts a Tile with the following zoom, x and y values based on a TMS URL. Returns None if the TMS url is invalid, or those
§Examples
let t = Tile::from_tms("/10/547/380.png");
assert_eq!(t, Tile::new(10, 547, 380));
assert_eq!(Tile::from_tms("foobar"), None);Sourcepub fn parent(&self) -> Option<Tile>
pub fn parent(&self) -> Option<Tile>
Returns the parent tile for this tile, i.e. the tile at the zoom-1 that this tile is
inside.
assert_eq!(Tile::new(1, 0, 0).unwrap().parent(), Tile::new(0, 0, 0));None if there is no parent, which is at zoom 0.
assert_eq!(Tile::new(0, 0, 0).unwrap().parent(), None);Sourcepub fn subtiles(&self) -> Option<[Tile; 4]>
pub fn subtiles(&self) -> Option<[Tile; 4]>
Returns the subtiles (child) tiles for this tile. The 4 tiles at zoom+1 which cover this tile. Returns None if this is at the maximum permissable zoom level, and hence there are no subtiles.
let t = Tile::new(0, 0, 0).unwrap();
let subtiles: [Tile; 4] = t.subtiles().unwrap();
assert_eq!(subtiles[0], Tile::new(1, 0, 0).unwrap());
assert_eq!(subtiles[1], Tile::new(1, 1, 0).unwrap());
assert_eq!(subtiles[2], Tile::new(1, 0, 1).unwrap());
assert_eq!(subtiles[3], Tile::new(1, 1, 1).unwrap());Sourcepub fn all_subtiles_iter(&self) -> AllSubTilesIterator ⓘ
pub fn all_subtiles_iter(&self) -> AllSubTilesIterator ⓘ
Iterate on all child tiles of this tile
Sourcepub fn centre_point(&self) -> LatLon
pub fn centre_point(&self) -> LatLon
Returns the LatLon for the centre of this tile.
Sourcepub fn center_point(&self) -> LatLon
pub fn center_point(&self) -> LatLon
Returns the LatLon for the centre of this tile.
Sourcepub fn nw_corner(&self) -> LatLon
pub fn nw_corner(&self) -> LatLon
Returns the LatLon of the top left, i.e. north west corner, of this tile.
Sourcepub fn ne_corner(&self) -> LatLon
pub fn ne_corner(&self) -> LatLon
Returns the LatLon of the top right, i.e. north east corner, of this tile.
Sourcepub fn sw_corner(&self) -> LatLon
pub fn sw_corner(&self) -> LatLon
Returns the LatLon of the bottom left, i.e. south west corner, of this tile.
Sourcepub fn se_corner(&self) -> LatLon
pub fn se_corner(&self) -> LatLon
Returns the LatLon of the bottom right, i.e. south east corner, of this tile.
pub fn top(&self) -> f32
pub fn bottom(&self) -> f32
pub fn left(&self) -> f32
pub fn right(&self) -> f32
Sourcepub fn tc_path<T: Display>(&self, ext: T) -> String
pub fn tc_path<T: Display>(&self, ext: T) -> String
Returns the TC (TileCache) path for storing this tile.
Sourcepub fn mp_path<T: Display>(&self, ext: T) -> String
pub fn mp_path<T: Display>(&self, ext: T) -> String
Returns the MP (MapProxy) path for storing this tile.
Sourcepub fn ts_path<T: Display>(&self, ext: T) -> String
pub fn ts_path<T: Display>(&self, ext: T) -> String
Returns the TS (TileStash safe) path for storing this tile.
Sourcepub fn zxy_path<T: Display>(&self, ext: T) -> String
pub fn zxy_path<T: Display>(&self, ext: T) -> String
Returns the ZXY path for storing this tile.
Sourcepub fn mt_path<T: Display>(&self, ext: T) -> String
pub fn mt_path<T: Display>(&self, ext: T) -> String
Returns the ModTileMetatile path for storing this tile
Sourcepub fn all() -> AllTilesIterator ⓘ
pub fn all() -> AllTilesIterator ⓘ
Returns an iterator that yields all the tiles possible, starting from 0/0/0. Tiles are
generated in a breath first manner, with all zoom 1 tiles before zoom 2 etc.
let mut all_tiles_iter = Tile::all();Sourcepub fn all_to_zoom(max_zoom: u8) -> AllTilesToZoomIterator ⓘ
pub fn all_to_zoom(max_zoom: u8) -> AllTilesToZoomIterator ⓘ
Returns an iterator that yields all the tiles from zoom 0 down to, and including, all the
tiles at max_zoom zoom level. Tiles are
generated in a breath first manner, with all zoom 1 tiles before zoom 2 etc.