diff --git a/.gitignore b/.gitignore index f35704d..72466f3 100644 --- a/.gitignore +++ b/.gitignore @@ -105,3 +105,5 @@ ENV/ cdk.out/ node_modules cdk.context.json + +notebooks/ diff --git a/titiler/cmr/templates/map.html b/titiler/cmr/templates/map.html index e67283a..9744217 100644 --- a/titiler/cmr/templates/map.html +++ b/titiler/cmr/templates/map.html @@ -122,6 +122,14 @@ // 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],