From 9802b2f8317ce3e3986a4b4a002b6a5774720340 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Sat, 18 Aug 2018 10:57:26 -0400 Subject: [PATCH] Restore 'custom' and 'none' options to background imagery list (closes #5226) --- modules/renderer/background.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/modules/renderer/background.js b/modules/renderer/background.js index ff9010004..b227784ca 100644 --- a/modules/renderer/background.js +++ b/modules/renderer/background.js @@ -211,7 +211,7 @@ export function rendererBackground(context) { matchImagery.forEach(function(d) { matchIDs[d.id] = true; }); return _backgroundSources.filter(function(source) { - return matchIDs[source.id]; + return matchIDs[source.id] || !source.polygon; // no polygon = worldwide }); }; @@ -378,20 +378,18 @@ export function rendererBackground(context) { data.imagery.features = {}; // build efficient index and querying for data.imagery - var world = [[[-180, -90], [-180, 90], [180, 90], [180, -90], [-180, -90]]]; var features = data.imagery.map(function(source) { + if (!source.polygon) return null; var feature = { type: 'Feature', - id: source.id, - properties: _omit(source, ['polygon']), - geometry: { - type: 'MultiPolygon', - coordinates: [ source.polygon || world ] - } + properties: { id: source.id }, + geometry: { type: 'MultiPolygon', coordinates: [ source.polygon ] } }; + data.imagery.features[source.id] = feature; return feature; - }); + }).filter(Boolean); + data.imagery.query = whichPolygon({ type: 'FeatureCollection', features: features