projects
/
rails.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(from parent 1:
dc0ada9
)
Fall back to the mapnik layer
author
Tom Hughes
<tom@compton.nu>
Fri, 23 Nov 2012 19:00:51 +0000
(19:00 +0000)
committer
Tom Hughes
<tom@compton.nu>
Fri, 23 Nov 2012 19:00:51 +0000
(19:00 +0000)
If there are no known layers in the layers string, then fall back to
showing the standard mapnik layer.
app/assets/javascripts/map.js.erb
patch
|
blob
|
history
diff --git
a/app/assets/javascripts/map.js.erb
b/app/assets/javascripts/map.js.erb
index 393e9cae7d3e88f3b3a01b718e084fe37a8934e2..9df9ca2d99cc7b435ad586699ec10b9e6f826435 100644
(file)
--- 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);
+ }
}