Add default "Locator Overlay" layer

A layer that is by default visible at <z16 and can
orient you with major roads, cities, borders, etc.

Fixes #1301
This commit is contained in:
John Firebaugh
2013-08-22 12:51:10 -07:00
parent 0180367399
commit d9142271ac
4 changed files with 32 additions and 2 deletions
+18 -1
View File
@@ -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",
+8
View File
@@ -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);
+5
View File
@@ -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;
+1 -1
View File
@@ -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);