diff --git a/data/imagery.json b/data/imagery.json index 437d50926..2c09535c8 100644 --- a/data/imagery.json +++ b/data/imagery.json @@ -13,12 +13,29 @@ "2", "3" ], - "default": "yes", + "default": true, "sourcetag": "Bing", "logo": "bing_maps.png", "logo_url": "http://www.bing.com/maps", "terms_url": "http://opengeodata.org/microsoft-imagery-details" }, + { + "name": "Locator Overlay", + "template": "http://{t}.tiles.mapbox.com/v3/openstreetmap.map-btyhiati/{z}/{x}/{y}.png", + "description": "Shows major features to help orient you.", + "overlay": true, + "default": true, + "scaleExtent": [ + 0, + 16 + ], + "subdomains": [ + "a", + "b", + "c" + ], + "terms_url": "http://mapbox.com/tos/" + }, { "name": "MapBox Satellite", "template": "http://{t}.tiles.mapbox.com/v3/openstreetmap.map-4wvf9l0l/{z}/{x}/{y}.png", diff --git a/js/id/renderer/background.js b/js/id/renderer/background.js index 72c3afca9..6ab8502ce 100644 --- a/js/id/renderer/background.js +++ b/js/id/renderer/background.js @@ -196,6 +196,14 @@ iD.Background = function(context) { background.baseLayerSource(findSource(chosen) || findSource("Bing")); } + var locator = _.find(backgroundSources, function(d) { + return d.overlay && d.default; + }); + + if (locator) { + background.toggleOverlayLayer(locator); + } + var overlays = (q.overlays || '').split(','); overlays.forEach(function(overlay) { overlay = findSource(overlay); diff --git a/js/id/renderer/background_source.js b/js/id/renderer/background_source.js index 0c3a5cf84..b42b729b1 100644 --- a/js/id/renderer/background_source.js +++ b/js/id/renderer/background_source.js @@ -49,6 +49,11 @@ iD.BackgroundSource = function(data) { }); }; + source.validZoom = function(z) { + return source.scaleExtent[0] <= z && + (source.name !== 'Locator Overlay' || source.scaleExtent[1] > z); + }; + source.copyrightNotices = function() {}; return source; diff --git a/js/id/renderer/tile_layer.js b/js/id/renderer/tile_layer.js index 1f0ca76d6..9acb2cc0d 100644 --- a/js/id/renderer/tile_layer.js +++ b/js/id/renderer/tile_layer.js @@ -65,7 +65,7 @@ iD.TileLayer = function() { function render(selection) { var requests = []; - if (tile.scaleExtent()[0] <= z) { + if (source.validZoom(z)) { tile().forEach(function(d) { addSource(d); requests.push(d);