Format
This commit is contained in:
parent
77e01776f5
commit
a9717d570d
5 changed files with 28 additions and 10 deletions
|
|
@ -58,7 +58,10 @@ pub async fn metrics_handler(handle: PrometheusHandle) -> impl IntoResponse {
|
|||
|
||||
match handle.render() {
|
||||
output if !output.is_empty() => (StatusCode::OK, output),
|
||||
_ => (StatusCode::INTERNAL_SERVER_ERROR, "Failed to render metrics".to_string()),
|
||||
_ => (
|
||||
StatusCode::INTERNAL_SERVER_ERROR,
|
||||
"Failed to render metrics".to_string(),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -72,7 +72,10 @@ pub fn parse_bounds(bounds_str: &str) -> Result<(f64, f64, f64, f64), (StatusCod
|
|||
if south > north {
|
||||
return Err((
|
||||
StatusCode::BAD_REQUEST,
|
||||
format!("Invalid bounds: south ({}) must be <= north ({})", south, north),
|
||||
format!(
|
||||
"Invalid bounds: south ({}) must be <= north ({})",
|
||||
south, north
|
||||
),
|
||||
));
|
||||
}
|
||||
if west > east {
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ pub enum FeatureInfo {
|
|||
#[derive(Clone, Serialize)]
|
||||
pub struct FeatureGroupResponse {
|
||||
name: String,
|
||||
features: Vec<FeatureInfo>,
|
||||
pub(crate) features: Vec<FeatureInfo>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Serialize)]
|
||||
|
|
|
|||
|
|
@ -89,9 +89,13 @@ pub async fn get_style(
|
|||
|
||||
fn build_style(is_dark: bool, layers: &[serde_json::Value], tile_url: &str) -> serde_json::Value {
|
||||
let (bg_color, water_color, land_color, road_color, text_color, text_halo) = if is_dark {
|
||||
("#1a1a1a", "#193447", "#1a1a1a", "#2a2a2a", "#888888", "#000000")
|
||||
(
|
||||
"#1a1a1a", "#193447", "#1a1a1a", "#2a2a2a", "#888888", "#000000",
|
||||
)
|
||||
} else {
|
||||
("#f8f4f0", "#aad3df", "#f8f4f0", "#ffffff", "#333333", "#ffffff")
|
||||
(
|
||||
"#f8f4f0", "#aad3df", "#f8f4f0", "#ffffff", "#333333", "#ffffff",
|
||||
)
|
||||
};
|
||||
|
||||
// Build layer list from metadata
|
||||
|
|
@ -238,7 +242,7 @@ fn build_style(is_dark: bool, layers: &[serde_json::Value], tile_url: &str) -> s
|
|||
serde_json::json!({
|
||||
"version": 8,
|
||||
"name": if is_dark { "Dark" } else { "Light" },
|
||||
"glyphs": "https://protomaps.github.io/basemaps-assets/fonts/{fontstack}/{range}.pbf",
|
||||
"glyphs": "/assets/fonts/{fontstack}/{range}.pbf",
|
||||
"sources": {
|
||||
"protomaps": {
|
||||
"type": "vector",
|
||||
|
|
|
|||
|
|
@ -42,10 +42,18 @@ impl GridIndex {
|
|||
for index in 0..lat.len() {
|
||||
let la = lat[index];
|
||||
let lo = lon[index];
|
||||
if la < min_lat { min_lat = la; }
|
||||
if la > max_lat { max_lat = la; }
|
||||
if lo < min_lon { min_lon = lo; }
|
||||
if lo > max_lon { max_lon = lo; }
|
||||
if la < min_lat {
|
||||
min_lat = la;
|
||||
}
|
||||
if la > max_lat {
|
||||
max_lat = la;
|
||||
}
|
||||
if lo < min_lon {
|
||||
min_lon = lo;
|
||||
}
|
||||
if lo > max_lon {
|
||||
max_lon = lo;
|
||||
}
|
||||
}
|
||||
|
||||
min_lat -= cell_size;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue