From 60ac224364e2951945cb9adbca8f9447a0337edf Mon Sep 17 00:00:00 2001 From: Kyler Chin <7539174+kylerchin@users.noreply.github.com> Date: Mon, 4 Nov 2024 23:02:25 -0800 Subject: [PATCH] delete all tiles in bbox at z level start fnn --- Cargo.toml | 1 + src/tile_save_and_get.rs | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 971930b..8d0a2a3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -137,6 +137,7 @@ strumbra = "0.5.1" compact_str = { version = "0.8.0", features = ["serde", "diesel"] } urlencoding = "2.1.3" url = "2.5.2" +slippy-map-tiles = "0.16.0" [[bin]] name = "maple" path = "src/maple/main.rs" diff --git a/src/tile_save_and_get.rs b/src/tile_save_and_get.rs index f4ceeec..dfe9f59 100644 --- a/src/tile_save_and_get.rs +++ b/src/tile_save_and_get.rs @@ -83,3 +83,20 @@ pub async fn get_tile( .first::(conn) .await } + +pub fn delete_all_tiles_in_bbox( + conn: &mut bb8::PooledConnection<'_, AsyncDieselConnectionManager>, + rect: &geo::Rect, + z: u8, + c: TileCategory, +) -> Result<(), anyhow::Error> { + //make bbox + let bbox = slippy_map_tiles::BBox::new( + rect.max().y as f32, + rect.min().x as f32, + rect.min().y as f32, + rect.max().x as f32, + ); + + Ok(()) +}