From 6e0006ffcfe3e7bda5c8a2ac3bc51499f0fd5b4e Mon Sep 17 00:00:00 2001 From: Miko <39791814+okimiko@users.noreply.github.com> Date: Sun, 9 Feb 2025 04:32:51 +0100 Subject: [PATCH] limit elevation lat/long decimal places to 7 (#1457) --- public/resources/elevation-control.js | 2 +- src/serve_data.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/public/resources/elevation-control.js b/public/resources/elevation-control.js index a1fda61..8821eae 100644 --- a/public/resources/elevation-control.js +++ b/public/resources/elevation-control.js @@ -18,7 +18,7 @@ class ElevationInfoControl { map.on('click', (e) => { var url = this.url; - var coord = {"z": Math.floor(map.getZoom()), "x": e.lngLat["lng"], "y": e.lngLat["lat"]}; + var coord = {"z": Math.floor(map.getZoom()), "x": e.lngLat["lng"].toFixed(7), "y": e.lngLat["lat"].toFixed(7)}; for(var key in coord) { url = url.replace(new RegExp('{'+ key +'}','g'), coord[key]); } diff --git a/src/serve_data.js b/src/serve_data.js index 6369aa2..5493ff2 100644 --- a/src/serve_data.js +++ b/src/serve_data.js @@ -259,8 +259,8 @@ export const serve_data = { let data = fetchTile.data; var param = { - long: bbox[0], - lat: bbox[1], + long: bbox[0].toFixed(7), + lat: bbox[1].toFixed(7), encoding, format, tile_size: TILE_SIZE,