Struct Tms

Source
pub struct Tms {
    pub tms: TileMatrixSet,
    pub is_quadtree: bool,
    /* private fields */
}
Expand description

Tile Matrix Set API.

Fields§

§tms: TileMatrixSet§is_quadtree: bool

Implementations§

Source§

impl Tms

Source

pub fn hilbert_id(&self, tile: &Xyz) -> u64

Get the hilbert index of a tile

Source

pub fn hilbert_to_tile(&self, h: u64) -> Xyz

Get the tile corresponding to a Hilbert index

Source§

impl Tms

Source

pub fn quadkey(&self, tile: &Xyz) -> String

Get the quadkey of a tile

§Arguments
  • tile : instance of Tile
Source

pub fn quadkey_to_tile(&self, qk: &str) -> Xyz

Get the tile corresponding to a quadkey

§Arguments
  • qk - A quadkey string.
Source§

impl Tms

Source

pub fn matrices(&self) -> &Vec<TileMatrix>

Iterate over matrices

Source

pub fn crs(&self) -> &Crs

Fetch CRS from epsg

Source

pub fn minzoom(&self) -> u8

TileMatrixSet minimum TileMatrix identifier

Source

pub fn maxzoom(&self) -> u8

TileMatrixSet maximum TileMatrix identifier

Source

pub fn custom( extent: Vec<f64>, crs: &Crs, tile_width: u16, tile_height: u16, matrix_scale: Option<Vec<u8>>, extent_crs: Option<&Crs>, minzoom: u8, maxzoom: u8, title: &str, id: &str, ordered_axes: Option<OrderedAxes>, geographic_crs: &Crs, ) -> Result<Self>

Construct a custom TileMatrixSet.

§Arguments
  • crs - Tile Matrix Set coordinate reference system
  • extent - Bounding box of the Tile Matrix Set, (left, bottom, right, top).
  • tile_width - Width of each tile of this tile matrix in pixels (default is 256).
  • tile_height - Height of each tile of this tile matrix in pixels (default is 256).
  • matrix_scale - Tiling schema coalescence coefficient (default: [1, 1] for EPSG:3857). Should be set to [2, 1] for EPSG:4326. see: http:///docs.opengeospatial.org/is/17-083r2/17-083r2.html#14
  • extent_crs - pyproj.CRS Extent’s coordinate reference system, as a pyproj CRS object. (default: same as input crs)
  • minzoom - Tile Matrix Set minimum zoom level (default is 0).
  • maxzoom - Tile Matrix Set maximum zoom level (default is 24).
  • title - Tile Matrix Set title (default is ‘Custom TileMatrixSet’)
  • id - Tile Matrix Set identifier (default is ‘Custom’)
  • ordered_axes
  • geographic_crs - Geographic (lat,lon) coordinate reference system (default is EPSG:4326)
Source

pub fn custom_resolutions( extent: Vec<f64>, crs: &Crs, tile_width: u16, tile_height: u16, extent_crs: Option<&Crs>, resolutions: Vec<f64>, title: &str, id: &str, ordered_axes: Option<OrderedAxes>, geographic_crs: &Crs, ) -> Result<Self>

Construct a custom TileMatrixSet with given resolutions

Source

pub fn matrix_z(&self, zoom: u8) -> Option<&TileMatrix>

Return the TileMatrix for a specific zoom without automatic tile matrix extension.

Source

pub fn matrix(&self, zoom: u8) -> Matrix<'_>

Return the TileMatrix for a specific zoom.

Source

pub fn resolution(&self, matrix: &TileMatrix) -> f64

Tile resolution for a TileMatrix.

Source

pub fn resolution_z(&self, zoom: u8) -> Option<f64>

Tile resolution for a specific zoom.

Source

pub fn zoom_for_res( &self, res: f64, max_z: Option<u8>, zoom_level_strategy: &ZoomLevelStrategy, min_z: Option<u8>, ) -> Result<u8>

Get TMS zoom level corresponding to a specific resolution.

§Arguments
  • res - Resolution in TMS unit.
  • max_z - Maximum zoom level (default is tms maxzoom).
  • zoom_level_strategy - Strategy to determine zoom level (same as in GDAL 3.2). LOWER will select the zoom level immediately below the theoretical computed non-integral zoom level. On the contrary, UPPER will select the immediately above zoom level. Defaults to AUTO which selects the closest zoom level. ref: https://gdal.org/drivers/raster/cog.html#raster-cog
  • min_z - Minimum zoom level (default is tms minzoom).
§Returns:
  • TMS zoom for a given resolution.
Source

pub fn xy(&self, lng: f64, lat: f64) -> Result<Coords>

Transform geographic longitude and latitude coordinates to TMS CRS

Source

pub fn xy_truncated(&self, lng: f64, lat: f64) -> Result<Coords>

Transform geographic longitude and latitude coordinates to TMS CRS. Truncate geographic coordinates to TMS geographic bbox.

Source

pub fn truncate_lnglat(&self, lng: f64, lat: f64) -> Result<(f64, f64)>

Truncate geographic coordinates to TMS geographic bbox.

Source

pub fn xy_tile(&self, xcoord: f64, ycoord: f64, zoom: u8) -> Xyz

Get the tile containing a Point (in TMS CRS).

§Arguments
  • xcoord, ycoord - A X and Y pair in TMS coordinate reference system.
  • zoom - The zoom level.
Source

pub fn tile(&self, lng: f64, lat: f64, zoom: u8) -> Result<Xyz>

Get the tile for a given geographic longitude and latitude pair.

§Arguments
  • lng, lat : A longitude and latitude pair in geographic coordinate reference system.
  • zoom : The zoom level.
Source

pub fn tile_truncated(&self, lng: f64, lat: f64, zoom: u8) -> Result<Xyz>

Get the tile for a given geographic longitude and latitude pair. Truncate inputs to limits of TMS geographic bounds.

§Arguments
  • lng, lat : A longitude and latitude pair in geographic coordinate reference system.
  • zoom : The zoom level.
Source

pub fn xy_ul(&self, tile: &Xyz) -> Coords

Return the upper left coordinate of the tile in TMS coordinate reference system.

§Arguments
  • tile: (x, y, z) tile coordinates or a Tile object we want the upper left coordinates of.
Source

pub fn xy_bounds(&self, tile: &Xyz) -> BoundingBox

Return the bounding box of the tile in TMS coordinate reference system.

§Arguments
  • tile: Tile object we want the bounding box of.
Source

pub fn ul(&self, tile: &Xyz) -> Result<Coords>

Return the upper left coordinates of the tile in geographic coordinate reference system.

§Arguments
  • tile - (x, y, z) tile coordinates or a Tile object we want the upper left geographic coordinates of.
Source

pub fn bounds(&self, tile: &Xyz) -> Result<BoundingBox>

Return the bounding box of the tile in geographic coordinate reference system.

§Arguments
  • tile - Tile object we want the bounding box of.
Source

pub fn xy_bbox(&self) -> BoundingBox

Return TMS bounding box in TileMatrixSet’s CRS.

Source

pub fn bbox(&self) -> Result<BoundingBox>

Return TMS bounding box in geographic coordinate reference system.

Source

pub fn intersect_tms(&self, bbox: &BoundingBox) -> bool

Check if a bounds intersects with the TMS bounds.

Source

pub fn tiles( &self, west: f64, south: f64, east: f64, north: f64, zooms: &[u8], truncate: bool, ) -> Result<impl Iterator<Item = Xyz>>

Get the tiles overlapped by a geographic bounding box

§Arguments
  • west, south, east, north - Bounding values in decimal degrees (geographic CRS).
  • zooms - One or more zoom levels.
  • truncate : Whether or not to truncate inputs to web mercator limits.
§Notes

A small epsilon is used on the south and east parameters so that this function yields exactly one tile when given the bounds of that same tile.

Source

pub fn xyz_iterator_geographic( &self, extend: &BoundingBox, minzoom: u8, maxzoom: u8, ) -> Result<XyzIterator>

Get iterator over all tiles overlapped by a geographic bounding box

Source

pub fn xyz_iterator( &self, extend: &BoundingBox, minzoom: u8, maxzoom: u8, ) -> XyzIterator

Get iterator over all tiles overlapped by a bounding box in TMS CRS

Source

pub fn hilbert_iterator(&self, minzoom: u8, maxzoom: u8) -> HilbertIterator

Get hilbert iterator over all tiles

Source

pub fn is_valid(&self, tile: &Xyz) -> bool

Check if a tile is valid.

Source

pub fn neighbors(&self, tile: &Xyz) -> Vec<Xyz>

The neighbors of a tile

The neighbors function makes no guarantees regarding neighbor tile ordering.

The neighbors function returns up to eight neighboring tiles, where tiles will be omitted when they are not valid.

§Arguments
  • tile - instance of Tile
Source

pub fn parent(&self, tile: &Xyz, zoom: Option<u8>) -> Result<Vec<Xyz>>

Get the parent of a tile

The parent is the tile of one zoom level lower that contains the given “child” tile.

§Arguments
  • tile - instance of Tile
  • zoom - Determines the zoom level of the returned parent tile. This defaults to one lower than the tile (the immediate parent).
Source

pub fn children(&self, tile: &Xyz, zoom: Option<u8>) -> Result<Vec<Xyz>>

Get the children of a tile

The children are ordered: top-left, top-right, bottom-right, bottom-left.

§Arguments
  • tile - instance of Tile
  • zoom - Determines the zoom level of the returned parent tile. This defaults to one lower than the tile (the immediate parent).

Trait Implementations§

Source§

impl Clone for Tms

Source§

fn clone(&self) -> Tms

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Tms

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl TryFrom<&TileMatrixSet> for Tms

Source§

type Error = TmsError

The type returned in the event of a conversion error.
Source§

fn try_from(tms: &TileMatrixSet) -> Result<Tms>

Performs the conversion.

Auto Trait Implementations§

§

impl Freeze for Tms

§

impl RefUnwindSafe for Tms

§

impl Send for Tms

§

impl Sync for Tms

§

impl Unpin for Tms

§

impl UnwindSafe for Tms

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> ErasedDestructor for T
where T: 'static,