mapserver: fix generation & allow .png url
This commit is contained in:
parent
57fcb38e25
commit
7aa17e3de3
|
@ -67,7 +67,7 @@ fn run_minetestmapper(
|
||||||
&format!(
|
&format!(
|
||||||
"{}:{}+{}+{}",
|
"{}:{}+{}+{}",
|
||||||
x * config.tile_size as i32,
|
x * config.tile_size as i32,
|
||||||
-1 - z * config.tile_size as i32,
|
-1 - y * config.tile_size as i32,
|
||||||
config.tile_size,
|
config.tile_size,
|
||||||
config.tile_size
|
config.tile_size
|
||||||
),
|
),
|
||||||
|
@ -85,7 +85,7 @@ fn read_tile_file(tile_path: &str) -> Result<Vec<u8>, Error> {
|
||||||
let mut tile_content = Vec::new();
|
let mut tile_content = Vec::new();
|
||||||
std::fs::File::open(&tile_path)
|
std::fs::File::open(&tile_path)
|
||||||
.map_err(Error::Io)?
|
.map_err(Error::Io)?
|
||||||
.read(&mut tile_content)
|
.read_to_end(&mut tile_content)
|
||||||
.map_err(Error::Io)?; // TODO resp_tile if error
|
.map_err(Error::Io)?; // TODO resp_tile if error
|
||||||
Ok(tile_content)
|
Ok(tile_content)
|
||||||
}
|
}
|
||||||
|
@ -152,7 +152,8 @@ async fn req_tile(
|
||||||
) -> tide::Result {
|
) -> tide::Result {
|
||||||
let z: i32 = req.param("z")?.parse()?;
|
let z: i32 = req.param("z")?.parse()?;
|
||||||
let x: i32 = req.param("x")?.parse()?;
|
let x: i32 = req.param("x")?.parse()?;
|
||||||
let y: i32 = req.param("y")?.parse()?;
|
let y = req.param("y")?;
|
||||||
|
let y = y.strip_suffix(".png").unwrap_or(y).parse()?;
|
||||||
|
|
||||||
let tile_dir = format!("{}{}/{}", config.output_path, z, x);
|
let tile_dir = format!("{}{}/{}", config.output_path, z, x);
|
||||||
let tile_path = format!("{}/{}.png", tile_dir, y);
|
let tile_path = format!("{}/{}.png", tile_dir, y);
|
||||||
|
|
Loading…
Reference in New Issue