From 90ca57ae1e2bf637f57ca236e01403b69b942893 Mon Sep 17 00:00:00 2001 From: vincentsarago Date: Thu, 15 Feb 2024 22:15:58 +0100 Subject: [PATCH] fix --- titiler/cmr/templates/map.html | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/titiler/cmr/templates/map.html b/titiler/cmr/templates/map.html index 9744217..50cbc06 100644 --- a/titiler/cmr/templates/map.html +++ b/titiler/cmr/templates/map.html @@ -107,6 +107,14 @@ ] } } else { + // Avoid bounds overflow and limit to the max TileMatrixSet bbox + bounds = [ + Math.max(bounds[0], {{ tms.bbox.left }}), + Math.max(bounds[1], {{ tms.bbox.bottom }}), + Math.min(bounds[2], {{ tms.bbox.right }}), + Math.min(bounds[3], {{ tms.bbox.top }}), + ] + geo = { "type": "FeatureCollection", "features": [bboxPolygon(bounds)] @@ -122,15 +130,8 @@ // Bounds crossing dateline if (bounds[0] > bounds[2]) { bounds[0] = bounds[0] - 360 - } else { - // Avoid bounds overflow and limit to the max TileMatrixSet bbox - bounds = [ - max(bounds[0], tms.xy_bbox.left), - max(bounds[1], tms.xy_bbox.bottom), - min(bounds[2], tms.xy_bbox.right), - min(bounds[3], tms.xy_bbox.top), - ] } + var left = bounds[0], bottom = bounds[1], right = bounds[2],