maplibre-rs/build.rs
2022-01-08 22:43:32 +01:00

33 lines
843 B
Rust

use std::path::Path;
use std::{env, fs};
use mapr_utils::mbtiles::extract;
use wgsl_validate::validate_project_wgsl;
pub const MUNICH_X: u32 = 17421;
pub const MUNICH_Y: u32 = 11360;
pub const MUNICH_Z: u8 = 15;
fn main() {
validate_project_wgsl();
let root_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
let out_dir = env::var("OUT_DIR").unwrap();
let out = Path::new(&out_dir).join("extracted-tiles");
if out.exists() && out.is_dir() {
fs::remove_dir_all(&out).unwrap()
}
let source = Path::new(&root_dir).join(format!("test-data/munich-{}.mbtiles", MUNICH_Z));
// Pack tiles around Munich HBF (100 tiles in each direction)
extract(
source,
out,
MUNICH_Z,
(MUNICH_X - 100)..(MUNICH_X + 100),
(MUNICH_Y - 100)..(MUNICH_Y + 100),
)
.unwrap();
}