pub struct Tile {
pub x: u32,
pub y: u32,
pub z: u8,
}Expand description
Tile X-Y-Z struct
Fields§
§x: u32x value (column)
y: u32y value (row – flipped in mbtiles)
z: u8z value (zoom level)
Implementations§
Source§impl Tile
impl Tile
Sourcepub fn try_new(x: u32, y: u32, z: u8) -> Result<Tile, UtilesCoreError>
pub fn try_new(x: u32, y: u32, z: u8) -> Result<Tile, UtilesCoreError>
Create a Tile with validity check
§Errors
Returns an error if the tile is invalid (e.g. x or y >= 2^z)
Sourcepub fn new_checked(x: u32, y: u32, z: u8) -> Option<Tile>
pub fn new_checked(x: u32, y: u32, z: u8) -> Option<Tile>
Construct a tile with validity check - returns Option<Tile>
Sourcepub fn bounds(&self) -> (f64, f64, f64, f64)
pub fn bounds(&self) -> (f64, f64, f64, f64)
Return bounds tuple (west, south, east, north) for the tile
Sourcepub fn from_row_major_id(id: u64) -> Tile
pub fn from_row_major_id(id: u64) -> Tile
Return tile from row-major tile-id
Sourcepub fn from_rmid(id: u64) -> Tile
pub fn from_rmid(id: u64) -> Tile
Return tile from row-major tile-id (alias for from_row_major_id)
Sourcepub fn fmt_zxy(&self, sep: Option<&str>) -> String
pub fn fmt_zxy(&self, sep: Option<&str>) -> String
Return zxy string with optional separator (default is ‘/’)
Sourcepub fn fmt_zxy_ext(&self, ext: &str, sep: Option<&str>) -> String
pub fn fmt_zxy_ext(&self, ext: &str, sep: Option<&str>) -> String
Return zxy string with extension and optional separator (default is ‘/’)
§Examples
use utiles_core::Tile;
let tile = Tile::new(1, 2, 3);
assert_eq!(tile.fmt_zxy_ext("png", Some("-")), "3-1-2.png");
assert_eq!(tile.fmt_zxy_ext("png", None), "3/1/2.png");Sourcepub fn from_quadkey(quadkey: &str) -> Result<Tile, UtilesCoreError>
pub fn from_quadkey(quadkey: &str) -> Result<Tile, UtilesCoreError>
Convert quadkey string to Tile
§Errors
Returns error on invalid quadkey (e.g. “1234” – oh no ‘4’ is invalid)
Sourcepub fn from_qk(qk: &str) -> Result<Tile, UtilesCoreError>
pub fn from_qk(qk: &str) -> Result<Tile, UtilesCoreError>
Convert quadkey string to Tile (alias for from_quadkey)
§Errors
Returns error on invalid quadkey (e.g. “1234” – oh no ‘4’ is invalid)
Sourcepub fn from_json_obj(json: &str) -> Result<Tile, UtilesCoreError>
pub fn from_json_obj(json: &str) -> Result<Tile, UtilesCoreError>
Sourcepub fn from_json_arr(json: &str) -> Result<Tile, UtilesCoreError>
pub fn from_json_arr(json: &str) -> Result<Tile, UtilesCoreError>
Sourcepub fn from_json(json: &str) -> Result<Tile, UtilesCoreError>
pub fn from_json(json: &str) -> Result<Tile, UtilesCoreError>
Return tile from json string either object or array
§Errors
Returns error if serde parsing fails
§Examples
use utiles_core::Tile;
let tile_from_obj = Tile::from_json(r#"{"x": 1, "y": 2, "z": 3}"#).unwrap();
assert_eq!(tile_from_obj, Tile::new(1, 2, 3));
let tile_from_arr = Tile::from_json(r#"[1, 2, 3]"#).unwrap();
assert_eq!(tile_from_arr, Tile::new(1, 2, 3));Sourcepub fn from_json_loose(json: &str) -> Result<Tile, UtilesCoreError>
pub fn from_json_loose(json: &str) -> Result<Tile, UtilesCoreError>
Return tile from json string either object or array
§Errors
Returns error if unable to parse json string
Sourcepub fn from_lnglat_zoom(
lng: f64,
lat: f64,
zoom: u8,
truncate: Option<bool>,
) -> Result<Tile, UtilesCoreError>
pub fn from_lnglat_zoom( lng: f64, lat: f64, zoom: u8, truncate: Option<bool>, ) -> Result<Tile, UtilesCoreError>
Return new Tile from given (lng, lat, zoom)
§Errors
Returns an error if the conversion fails resulting in invalid tile
Sourcepub fn down_right(&self) -> Tile
pub fn down_right(&self) -> Tile
Return the tile to the bottom right
Sourcepub fn children_zorder(&self, zoom: Option<u8>) -> Vec<Tile>
pub fn children_zorder(&self, zoom: Option<u8>) -> Vec<Tile>
Return the children tiles of the tile
Sourcepub fn siblings(&self) -> Vec<Tile>
pub fn siblings(&self) -> Vec<Tile>
Return sibling tiles that share the same parent tile (not neighbors)
Sourcepub fn feature(
&self,
opts: &FeatureOptions,
) -> Result<TileFeature, UtilesCoreError>
pub fn feature( &self, opts: &FeatureOptions, ) -> Result<TileFeature, UtilesCoreError>
Return a TileFeature for the tile
§Errors
Returns an error if the feature creation fails (which may be impossible [2024-08-14])
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Tile
impl<'de> Deserialize<'de> for Tile
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Tile, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Tile, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl From<MbtTileRow> for Tile
impl From<MbtTileRow> for Tile
Source§fn from(row: MbtTileRow) -> Self
fn from(row: MbtTileRow) -> Self
Source§impl From<Tile> for SiblingRelationship
impl From<Tile> for SiblingRelationship
Source§fn from(value: Tile) -> SiblingRelationship
fn from(value: Tile) -> SiblingRelationship
Source§impl Ord for Tile
impl Ord for Tile
Source§impl PartialOrd for Tile
impl PartialOrd for Tile
Source§impl Serialize for Tile
impl Serialize for Tile
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Source§impl TileChildren1 for Tile
impl TileChildren1 for Tile
Source§impl TileLike for &Tile
impl TileLike for &Tile
fn yup(&self) -> u32
fn xyz_str_fslash(&self) -> String
fn zxy_str_fslash(&self) -> String
fn xyz_str_sep(&self, sep: &str) -> String
fn zxy_str_sep(&self, sep: &str) -> String
Source§fn row_major_id(&self) -> u64
fn row_major_id(&self) -> u64
Source§fn bbox(&self) -> (f64, f64, f64, f64)
fn bbox(&self) -> (f64, f64, f64, f64)
fn geobbox(&self) -> BBox
fn webbbox(&self) -> WebBBox
fn bbox_string(&self) -> String
Source§fn json_arr_min(&self) -> String
fn json_arr_min(&self) -> String
Source§fn tuple_string(&self) -> String
fn tuple_string(&self) -> String
(x, y, z)Source§fn mbtiles_sql_where(&self) -> String
fn mbtiles_sql_where(&self) -> String
WHERE clause for querying mbtiles (y is up)Source§impl TileLike for Tile
impl TileLike for Tile
fn yup(&self) -> u32
fn xyz_str_fslash(&self) -> String
fn zxy_str_fslash(&self) -> String
fn xyz_str_sep(&self, sep: &str) -> String
fn zxy_str_sep(&self, sep: &str) -> String
Source§fn row_major_id(&self) -> u64
fn row_major_id(&self) -> u64
Source§fn bbox(&self) -> (f64, f64, f64, f64)
fn bbox(&self) -> (f64, f64, f64, f64)
fn geobbox(&self) -> BBox
fn webbbox(&self) -> WebBBox
fn bbox_string(&self) -> String
Source§fn json_arr_min(&self) -> String
fn json_arr_min(&self) -> String
Source§fn tuple_string(&self) -> String
fn tuple_string(&self) -> String
(x, y, z)Source§fn mbtiles_sql_where(&self) -> String
fn mbtiles_sql_where(&self) -> String
WHERE clause for querying mbtiles (y is up)Source§impl TileParent for Tile
impl TileParent for Tile
impl Copy for Tile
impl Eq for Tile
impl StructuralPartialEq for Tile
Auto Trait Implementations§
impl Freeze for Tile
impl RefUnwindSafe for Tile
impl Send for Tile
impl Sync for Tile
impl Unpin for Tile
impl UnwindSafe for Tile
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
type Err = Infallible
fn into_result(self) -> Result<T, <T as IntoResult<T>>::Err>
Source§impl<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read moreSource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read moreSource§fn fg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
Source§fn bg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
Source§fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
Source§fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> ServiceExt for T
impl<T> ServiceExt for T
Source§fn add_extension<T>(self, value: T) -> AddExtension<Self, T>where
Self: Sized,
fn add_extension<T>(self, value: T) -> AddExtension<Self, T>where
Self: Sized,
Source§fn compression(self) -> Compression<Self>where
Self: Sized,
fn compression(self) -> Compression<Self>where
Self: Sized,
Source§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
Source§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
Source§fn set_request_id<M>(
self,
header_name: HeaderName,
make_request_id: M,
) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
fn set_request_id<M>(
self,
header_name: HeaderName,
make_request_id: M,
) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
Source§fn set_x_request_id<M>(self, make_request_id: M) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
fn set_x_request_id<M>(self, make_request_id: M) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
x-request-id as the header name. Read moreSource§fn propagate_request_id(
self,
header_name: HeaderName,
) -> PropagateRequestId<Self>where
Self: Sized,
fn propagate_request_id(
self,
header_name: HeaderName,
) -> PropagateRequestId<Self>where
Self: Sized,
Source§fn propagate_x_request_id(self) -> PropagateRequestId<Self>where
Self: Sized,
fn propagate_x_request_id(self) -> PropagateRequestId<Self>where
Self: Sized,
x-request-id as the header name. Read more