mapserver: fix zoom mkdirs
This commit is contained in:
parent
f5aa0349ee
commit
e21c3f825b
@ -196,7 +196,7 @@ fn generate_tile(
|
||||
}
|
||||
std::cmp::Ordering::Greater => {
|
||||
let ntile_path =
|
||||
get_dep_tile(z - 1, x / 2, y / 2, tasks.clone(), config.clone())?;
|
||||
get_dep_tile(z - 1, lock_coord.1 / 2, lock_coord.2 / 2, tasks.clone(), config.clone())?;
|
||||
let ntile = image::open(ntile_path).map_err(Error::Image)?;
|
||||
let ntile = image::imageops::resize(
|
||||
&ntile,
|
||||
@ -205,6 +205,18 @@ fn generate_tile(
|
||||
image::imageops::Nearest,
|
||||
);
|
||||
|
||||
let tile0_dir = format!("{}{}/{}", config.output_path, z, lock_coord.1);
|
||||
let tile1_dir =
|
||||
format!("{}{}/{}", config.output_path, z, lock_coord.1 + 1);
|
||||
std::fs::create_dir_all(&tile0_dir).map_err(|e| {
|
||||
error!("Generating tile ({},{},{}): {}", z, x, y, e);
|
||||
Error::Io(e)
|
||||
})?;
|
||||
std::fs::create_dir_all(&tile1_dir).map_err(|e| {
|
||||
error!("Generating tile ({},{},{}): {}", z, x, y, e);
|
||||
Error::Io(e)
|
||||
})?;
|
||||
|
||||
image::imageops::crop_imm(
|
||||
&ntile,
|
||||
0,
|
||||
@ -213,10 +225,7 @@ fn generate_tile(
|
||||
config.tile_size as u32,
|
||||
)
|
||||
.to_image()
|
||||
.save(format!(
|
||||
"{}{}/{}/{}.png",
|
||||
config.output_path, z, lock_coord.1, lock_coord.2
|
||||
))
|
||||
.save(format!("{}/{}.png", tile0_dir, lock_coord.2))
|
||||
.map_err(|e| {
|
||||
error!(
|
||||
"Generating tile ({},{},{}): {}",
|
||||
@ -232,13 +241,7 @@ fn generate_tile(
|
||||
config.tile_size as u32,
|
||||
)
|
||||
.to_image()
|
||||
.save(format!(
|
||||
"{}{}/{}/{}.png",
|
||||
config.output_path,
|
||||
z,
|
||||
lock_coord.1,
|
||||
lock_coord.2 + 1
|
||||
))
|
||||
.save(format!("{}/{}.png", tile0_dir, lock_coord.2 + 1))
|
||||
.map_err(|e| {
|
||||
error!(
|
||||
"Generating tile ({},{},{}): {}",
|
||||
@ -257,13 +260,7 @@ fn generate_tile(
|
||||
config.tile_size as u32,
|
||||
)
|
||||
.to_image()
|
||||
.save(format!(
|
||||
"{}{}/{}/{}.png",
|
||||
config.output_path,
|
||||
z,
|
||||
lock_coord.1 + 1,
|
||||
lock_coord.2
|
||||
))
|
||||
.save(format!("{}/{}.png", tile1_dir, lock_coord.2))
|
||||
.map_err(|e| {
|
||||
error!(
|
||||
"Generating tile ({},{},{}): {}",
|
||||
@ -282,13 +279,7 @@ fn generate_tile(
|
||||
config.tile_size as u32,
|
||||
)
|
||||
.to_image()
|
||||
.save(format!(
|
||||
"{}{}/{}/{}.png",
|
||||
config.output_path,
|
||||
z,
|
||||
lock_coord.1 + 1,
|
||||
lock_coord.2 + 1
|
||||
))
|
||||
.save(format!("{}/{}.png", tile1_dir, lock_coord.2 + 1))
|
||||
.map_err(|e| {
|
||||
error!(
|
||||
"Generating tile ({},{},{}): {}",
|
||||
|
Loading…
x
Reference in New Issue
Block a user