Use address instead of position for map debug handler

This commit is contained in:
Paul van Tilburg 2022-02-17 22:25:13 +01:00
parent 4920ab4abd
commit f1a303edc0
Signed by untrusted user: paul
GPG Key ID: C6DE073EDA9EEC4D
1 changed files with 6 additions and 3 deletions

View File

@ -61,16 +61,19 @@ async fn forecast_geo(
/// Handler for showing the current map with the geocoded position for a specific metric.
///
/// Note: This handler is mosly used for debugging purposes!
#[get("/map?<lat>&<lon>&<metric>")]
#[get("/map?<address>&<metric>")]
async fn show_map(
lat: f64,
lon: f64,
address: String,
metric: Metric,
maps_handle: &State<MapsHandle>,
) -> Option<Custom<Vec<u8>>> {
use image::{GenericImage, Rgba};
use std::io::Cursor;
let position = resolve_address(address).await?;
let lat = position.lat;
let lon = position.lon;
let now = Instant::now();
let maps = maps_handle.lock().expect("Maps handle lock was poisoned");
let mut image = match metric {