maptiler-cloud
Rust wrapper around the Maptiler Cloud API
Supports requesting all currently available tilesets
Tiles are requested using the Tiled Web Map format.
X and Y coordinates are specified, and a zoom level is specified.
Example Usage
#[tokio::main]
async fn main() {
let maptiler = maptiler_cloud::Maptiler::new("placeholder api key").unwrap();
let x = 2;
let y = 1;
let zoom = 2;
let tile_request = maptiler_cloud::TileRequest::new(
maptiler_cloud::TileSet::Satellite,
x,
y,
zoom
).unwrap();
let constructed = maptiler.create_request(tile_request);
let satellite_jpg = constructed.execute().await.unwrap();
assert_eq!(&satellite_jpg[0..3], &[0xFF, 0xD8, 0xFF]);
}
From there, most users will write those bytes to a file, or load them into another function
that will be able to display the image from the raw JPEG bytes.