[−][src]Function osm_tile_downloader::fetch
pub async fn fetch<'_>(cfg: Config<'_>) -> Result<()>
Asynchronously fetch the open street map tiles specified in cfg
and save them
to the file system.
Creates the required directories recursively and overwrites any existing files at the destination.
Example
use osm_tile_downloader::{fetch, BoundingBox, Config}; let config = Config { bounding_box: BoundingBox::new_deg(50.811, 6.1649, 50.7492, 6.031), fetch_rate: 10, output_folder: Path::new("./tiles"), request_retries_amount: 3, url: "https://{s}.tile.openstreetmap.de/{z}/{x}/{y}.png", timeout_secs: 30, zoom_level: 10, }; fetch(config).await.expect("failed fetching tiles");
Panics
Panics if the specified output folder exists and is not a folder but a file.