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
impl Tms
Sourcepub fn hilbert_id(&self, tile: &Xyz) -> u64
pub fn hilbert_id(&self, tile: &Xyz) -> u64
Get the hilbert index of a tile
Sourcepub fn hilbert_to_tile(&self, h: u64) -> Xyz
pub fn hilbert_to_tile(&self, h: u64) -> Xyz
Get the tile corresponding to a Hilbert index
Source§impl Tms
impl Tms
Sourcepub fn matrices(&self) -> &Vec<TileMatrix>
pub fn matrices(&self) -> &Vec<TileMatrix>
Iterate over matrices
Sourcepub 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>
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 systemextent
- 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#14extent_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)
Sourcepub 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>
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
Sourcepub fn matrix_z(&self, zoom: u8) -> Option<&TileMatrix>
pub fn matrix_z(&self, zoom: u8) -> Option<&TileMatrix>
Return the TileMatrix for a specific zoom without automatic tile matrix extension.
Sourcepub fn resolution(&self, matrix: &TileMatrix) -> f64
pub fn resolution(&self, matrix: &TileMatrix) -> f64
Tile resolution for a TileMatrix.
Sourcepub fn resolution_z(&self, zoom: u8) -> Option<f64>
pub fn resolution_z(&self, zoom: u8) -> Option<f64>
Tile resolution for a specific zoom.
Sourcepub fn zoom_for_res(
&self,
res: f64,
max_z: Option<u8>,
zoom_level_strategy: &ZoomLevelStrategy,
min_z: Option<u8>,
) -> Result<u8>
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-cogmin_z
- Minimum zoom level (default is tms minzoom).
§Returns:
- TMS zoom for a given resolution.
Sourcepub fn xy(&self, lng: f64, lat: f64) -> Result<Coords>
pub fn xy(&self, lng: f64, lat: f64) -> Result<Coords>
Transform geographic longitude and latitude coordinates to TMS CRS
Sourcepub fn xy_truncated(&self, lng: f64, lat: f64) -> Result<Coords>
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.
Sourcepub fn truncate_lnglat(&self, lng: f64, lat: f64) -> Result<(f64, f64)>
pub fn truncate_lnglat(&self, lng: f64, lat: f64) -> Result<(f64, f64)>
Truncate geographic coordinates to TMS geographic bbox.
Sourcepub fn xy_tile(&self, xcoord: f64, ycoord: f64, zoom: u8) -> Xyz
pub fn xy_tile(&self, xcoord: f64, ycoord: f64, zoom: u8) -> Xyz
Get the tile containing a Point (in TMS CRS).
§Arguments
xcoord
, ycoord - AX
andY
pair in TMS coordinate reference system.zoom
- The zoom level.
Sourcepub fn tile(&self, lng: f64, lat: f64, zoom: u8) -> Result<Xyz>
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.
Sourcepub fn tile_truncated(&self, lng: f64, lat: f64, zoom: u8) -> Result<Xyz>
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.
Sourcepub fn xy_ul(&self, tile: &Xyz) -> Coords
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.
Sourcepub fn xy_bounds(&self, tile: &Xyz) -> BoundingBox
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.
Sourcepub fn ul(&self, tile: &Xyz) -> Result<Coords>
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.
Sourcepub fn bounds(&self, tile: &Xyz) -> Result<BoundingBox>
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.
Sourcepub fn xy_bbox(&self) -> BoundingBox
pub fn xy_bbox(&self) -> BoundingBox
Return TMS bounding box in TileMatrixSet’s CRS.
Sourcepub fn bbox(&self) -> Result<BoundingBox>
pub fn bbox(&self) -> Result<BoundingBox>
Return TMS bounding box in geographic coordinate reference system.
Sourcepub fn intersect_tms(&self, bbox: &BoundingBox) -> bool
pub fn intersect_tms(&self, bbox: &BoundingBox) -> bool
Check if a bounds intersects with the TMS bounds.
Sourcepub fn tiles(
&self,
west: f64,
south: f64,
east: f64,
north: f64,
zooms: &[u8],
truncate: bool,
) -> Result<impl Iterator<Item = Xyz>>
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.
Sourcepub fn xyz_iterator_geographic(
&self,
extend: &BoundingBox,
minzoom: u8,
maxzoom: u8,
) -> Result<XyzIterator>
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
Sourcepub fn xyz_iterator(
&self,
extend: &BoundingBox,
minzoom: u8,
maxzoom: u8,
) -> XyzIterator ⓘ
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
Sourcepub fn hilbert_iterator(&self, minzoom: u8, maxzoom: u8) -> HilbertIterator
pub fn hilbert_iterator(&self, minzoom: u8, maxzoom: u8) -> HilbertIterator
Get hilbert iterator over all tiles
Sourcepub fn neighbors(&self, tile: &Xyz) -> Vec<Xyz>
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
Sourcepub fn parent(&self, tile: &Xyz, zoom: Option<u8>) -> Result<Vec<Xyz>>
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 Tilezoom
- Determines the zoom level of the returned parent tile. This defaults to one lower than the tile (the immediate parent).
Sourcepub fn children(&self, tile: &Xyz, zoom: Option<u8>) -> Result<Vec<Xyz>>
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 Tilezoom
- Determines the zoom level of the returned parent tile. This defaults to one lower than the tile (the immediate parent).