Skip to content

Commit

Permalink
Merge pull request #20 from developmentseed/patch/limit-bounds-to-tms…
Browse files Browse the repository at this point in the history
…-bounds

limit layer bounds to the max TMS bounds
  • Loading branch information
vincentsarago authored Feb 15, 2024
2 parents 68b0568 + dc6f9df commit a116c55
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,5 @@ ENV/
cdk.out/
node_modules
cdk.context.json

notebooks/
8 changes: 8 additions & 0 deletions titiler/cmr/templates/map.html
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down

0 comments on commit a116c55

Please sign in to comment.