Signed-off-by: Frank Villaro-Dixon <frank@villaro-dixon.eu>
This commit is contained in:
Frank Villaro-Dixon 2024-04-21 15:18:24 +02:00
parent c00c8bdebc
commit 6c5f2d05ca
2 changed files with 9 additions and 11 deletions

View file

@ -1,7 +1,7 @@
use std::sync::Arc; use std::sync::Arc;
use gdal::errors::GdalError;
use gdal::Dataset; use gdal::Dataset;
use gdal::{errors::GdalError, GeoTransformEx};
use tracing::{debug, debug_span, error, info}; use tracing::{debug, debug_span, error, info};
@ -42,7 +42,7 @@ impl DatasetRepository {
return None; return None;
} }
Ok(ds) => { Ok(ds) => {
let mds = Arc::new(MyDataset { ds: ds }); let mds = Arc::new(MyDataset { ds });
self.cache.insert(full_filename.clone(), mds).await; self.cache.insert(full_filename.clone(), mds).await;
} }
} }

View file

@ -2,25 +2,23 @@ mod dem;
use axum::{ use axum::{
extract::{Extension, Path, Query, State}, extract::{Extension, Path, Query, State},
http::{response, StatusCode}, http::StatusCode,
response::{IntoResponse, Response}, response::{IntoResponse, Response},
routing::get, routing::get,
Json, Router, Json, Router,
}; };
use axum_macros::debug_handler; use axum_macros::debug_handler;
use std::{borrow::Borrow, fmt}; use std::env;
use std::{env, str::FromStr};
use tokio::sync::mpsc::error;
use serde::ser::{SerializeSeq, Serializer}; use serde::ser::{SerializeSeq, Serializer};
use serde::{Deserialize, Deserializer, Serialize}; use serde::{Deserialize, Deserializer, Serialize};
use serde_qs::axum::{QsQuery, QsQueryConfig, QsQueryRejection}; use serde_qs::axum::{QsQueryConfig, QsQueryRejection};
use tower_http::trace::TraceLayer; use tower_http::trace::TraceLayer;
use tower_http::{ use tower_http::{
services::ServeDir, services::ServeDir,
trace::{self, DefaultMakeSpan}, trace::{self},
}; };
use tracing::{error, info, Level, Span}; use tracing::{error, info, Level};
use dem::DatasetRepository; use dem::DatasetRepository;
@ -153,9 +151,9 @@ async fn get_elevation(
if query_opts.json { if query_opts.json {
let r = Ele { elevation: ele }; let r = Ele { elevation: ele };
return Json(r).into_response(); Json(r).into_response()
} else { } else {
return format!("{}", ele).into_response(); format!("{}", ele).into_response()
} }
} }