Add support for DigitalGlobe imagery vintage overlays

(see https://github.com/osmlab/editor-layer-index/issues/371)
This commit is contained in:
Bryan Housel
2017-11-01 13:46:13 -04:00
parent 475db33b3f
commit a0a197a69e
8 changed files with 200 additions and 1166 deletions
+5
View File
@@ -2951,8 +2951,13 @@ img.tile-removing {
border-radius: 2px;
padding: 0 4px;
margin-top: 10px;
margin-right: 10px;
color: white;
}
[dir='rtl'] .panel-content .button {
margin-right: auto;
margin-left: 10px;
}
.panel-content-history .links a {
margin-left: 10px;
+2
View File
@@ -286,6 +286,8 @@ en:
unknown: Unknown
show_tiles: Show Tiles
hide_tiles: Hide Tiles
show_vintage: Show Vintage
hide_vintage: Hide Vintage
history:
key: H
title: History
+127 -1157
View File
File diff suppressed because one or more lines are too long
+17 -1
View File
@@ -361,7 +361,9 @@
"accuracy": "Accuracy",
"unknown": "Unknown",
"show_tiles": "Show Tiles",
"hide_tiles": "Hide Tiles"
"hide_tiles": "Hide Tiles",
"show_vintage": "Show Vintage",
"hide_vintage": "Hide Vintage"
},
"history": {
"key": "H",
@@ -5828,6 +5830,13 @@
"description": "Premium DigitalGlobe satellite imagery.",
"name": "DigitalGlobe Premium Imagery"
},
"DigitalGlobe-Premium-vintage": {
"attribution": {
"text": "Terms & Feedback"
},
"description": "Imagery boundaries and capture dates. Labels appear at zoom level 14 and higher.",
"name": "DigitalGlobe Premium Imagery Vintage"
},
"DigitalGlobe-Standard": {
"attribution": {
"text": "Terms & Feedback"
@@ -5835,6 +5844,13 @@
"description": "Standard DigitalGlobe satellite imagery.",
"name": "DigitalGlobe Standard Imagery"
},
"DigitalGlobe-Standard-vintage": {
"attribution": {
"text": "Terms & Feedback"
},
"description": "Imagery boundaries and capture dates. Labels appear at zoom level 14 and higher.",
"name": "DigitalGlobe Standard Imagery Vintage"
},
"EsriWorldImagery": {
"attribution": {
"text": "Terms & Feedback"
+2 -2
View File
@@ -47,7 +47,7 @@ export function rendererBackground(context) {
var b = background.baseLayerSource(),
o = overlayLayers
.filter(function (d) { return !d.source().isLocatorOverlay(); })
.filter(function (d) { return !d.source().isLocatorOverlay() && !d.source().isHidden(); })
.map(function (d) { return d.source().id; })
.join(','),
meters = geoOffsetToMeters(b.offset()),
@@ -86,7 +86,7 @@ export function rendererBackground(context) {
var imageryUsed = [b.imageryUsed()];
overlayLayers
.filter(function (d) { return !d.source().isLocatorOverlay(); })
.filter(function (d) { return !d.source().isLocatorOverlay() && !d.source().isHidden(); })
.forEach(function (d) { imageryUsed.push(d.source().imageryUsed()); });
var gpx = context.layers().layer('gpx');
+7
View File
@@ -133,6 +133,13 @@ export function rendererBackgroundSource(data) {
};
/* hides a source from the list, but leaves it available for use */
source.isHidden = function() {
return source.id === 'DigitalGlobe-Premium-vintage' ||
source.id === 'DigitalGlobe-Standard-vintage';
};
source.copyrightNotices = function() {};
+2 -2
View File
@@ -206,8 +206,8 @@ export function uiBackground(context) {
function update() {
backgroundList.call(drawList, 'radio', clickSetSource, function(d) { return !d.overlay; });
overlayList.call(drawList, 'checkbox', clickSetOverlay, function(d) { return d.overlay; });
backgroundList.call(drawList, 'radio', clickSetSource, function(d) { return !d.isHidden() && !d.overlay; });
overlayList.call(drawList, 'checkbox', clickSetOverlay, function(d) { return !d.isHidden() && d.overlay; });
selectLayer();
updateOffsetVal();
+38 -4
View File
@@ -20,8 +20,11 @@ export function uiPanelBackground(context) {
var debouncedRedraw = _debounce(redraw, 250);
function redraw(selection) {
if (currSourceName !== background.baseLayerSource().name()) {
currSourceName = background.baseLayerSource().name();
var source = background.baseLayerSource(),
isDG = (source.id.match(/^DigitalGlobe/i) !== null);
if (currSourceName !== source.name()) {
currSourceName = source.name();
metadata = {};
}
@@ -36,6 +39,9 @@ export function uiPanelBackground(context) {
.text(currSourceName);
metadataKeys.forEach(function(k) {
// DigitalGlobe vintage is available in raster layers for now.
if (isDG && k === 'vintage') return;
list
.append('li')
.attr('class', 'background-info-list-' + k)
@@ -48,11 +54,11 @@ export function uiPanelBackground(context) {
debouncedGetMetadata(selection);
var toggle = context.getDebug('tile') ? 'hide_tiles' : 'show_tiles';
var toggleTiles = context.getDebug('tile') ? 'hide_tiles' : 'show_tiles';
selection
.append('a')
.text(t('info_panels.background.' + toggle))
.text(t('info_panels.background.' + toggleTiles))
.attr('href', '#')
.attr('class', 'button button-toggle-tiles')
.on('click', function() {
@@ -60,6 +66,34 @@ export function uiPanelBackground(context) {
context.setDebug('tile', !context.getDebug('tile'));
selection.call(redraw);
});
if (isDG) {
var key = source.id + '-vintage';
var sourceVintage = context.background().findSource(key);
var showsVintage = context.background().showsLayer(sourceVintage);
var toggleVintage = showsVintage ? 'hide_vintage' : 'show_vintage';
selection
.append('a')
.text(t('info_panels.background.' + toggleVintage))
.attr('href', '#')
.attr('class', 'button button-toggle-vintage')
.on('click', function() {
d3_event.preventDefault();
context.background().toggleOverlayLayer(sourceVintage);
selection.call(redraw);
});
}
// disable if necessary
['DigitalGlobe-Premium', 'DigitalGlobe-Standard'].forEach(function(layerId) {
if (source.id !== layerId) {
var key = layerId + '-vintage';
var sourceVintage = context.background().findSource(key);
if (context.background().showsLayer(sourceVintage)) {
context.background().toggleOverlayLayer(sourceVintage);
}
}
});
}