X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/0c2d538aa7394b3d040cbe40cc6b3f5d26de4850..fde2744f749a70afcd1f77bc47558476da85ffd3:/app/assets/javascripts/map.js.erb diff --git a/app/assets/javascripts/map.js.erb b/app/assets/javascripts/map.js.erb index 393e9cae7..9df9ca2d9 100644 --- a/app/assets/javascripts/map.js.erb +++ b/app/assets/javascripts/map.js.erb @@ -184,11 +184,16 @@ function getMapLayers() { } function setMapLayers(layerConfig) { + var foundLayer = false; for (var i = 0; i < layers.length; i++) { if (layerConfig.indexOf(layers[i].layerCode) >= 0) { map.addLayer(layers[i].layer); + foundLayer = true; } else { map.removeLayer(layers[i].layer); } } + if (!foundLayer) { + map.addLayer(layers[0].layer); + } }