From: Tom Hughes Date: Fri, 23 Nov 2012 19:00:51 +0000 (+0000) Subject: Fall back to the mapnik layer X-Git-Tag: live~5215 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/8e27c78d3cb2162d963b49e25519b5d213d74730?hp=dc0ada9515da141915763a3187b61174ee3f5015 Fall back to the mapnik layer If there are no known layers in the layers string, then fall back to showing the standard mapnik layer. --- 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); + } }