Skip to content

Commit

Permalink
Gracefully handle missing tile service bounds in map preview
Browse files Browse the repository at this point in the history
  • Loading branch information
sikmir committed Nov 18, 2019
1 parent 10eb619 commit 65d73d5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions handlers/templates/map.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,13 @@

var layer = null;
d3.json('./', function(tileJSON) {
var b = tileJSON.bounds;
if (tileJSON.bounds) {
var b = tileJSON.bounds;

// TODO: optimize and prevent jitter
map.fitBounds([[b[1], b[0]], [b[3], b[2]]]);
}

// TODO: optimize and prevent jitter
map.fitBounds([[b[1], b[0]], [b[3], b[2]]]);
if (tileJSON.maxzoom && tileJSON.maxzoom < map.getZoom()){
map.setZoom(tileJSON.maxzoom);
}
Expand Down

0 comments on commit 65d73d5

Please sign in to comment.