aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2013-01-18 18:48:22 +0000
committerMatthew Somerville <matthew@mysociety.org>2013-01-18 18:48:22 +0000
commitbf239bf5dfc3e02015f5d200d37f867a1deeb427 (patch)
treeb18c718336e69057f3bd7d65084d632c5ad86dbe
parent401da7a5661fda2e37262b88a2d108b04ab1064b (diff)
Add layer switcher to current map task bar.
-rwxr-xr-xtemplates/web/default/around/display_location.html3
-rw-r--r--web/js/map-wmts-zurich.js21
2 files changed, 19 insertions, 5 deletions
diff --git a/templates/web/default/around/display_location.html b/templates/web/default/around/display_location.html
index 85f89e130..c9586c393 100755
--- a/templates/web/default/around/display_location.html
+++ b/templates/web/default/around/display_location.html
@@ -52,6 +52,9 @@
[% map_html %]
<p id='sub_map_links'>
+ [% IF c.cobrand.moniker == 'zurich' %]
+ <a class="hidden-nojs" id="map_layer_toggle" href="">Stadtplan</a>
+ [% END %]
[% IF c.req.params.no_pins %]
<a id='hide_pins_link' rel='nofollow' href='[% c.uri_with( { no_pins => 0 } ) %]'>[% loc('Show pins') %]</a>
[% ELSE %]
diff --git a/web/js/map-wmts-zurich.js b/web/js/map-wmts-zurich.js
index 7712742bb..12d267775 100644
--- a/web/js/map-wmts-zurich.js
+++ b/web/js/map-wmts-zurich.js
@@ -2,6 +2,16 @@
* Maps for FMZ using Zurich council's WMTS tile server
*/
+$(function(){
+ $('#map_layer_toggle').toggle(function(){
+ $(this).text('Luftbild');
+ fixmystreet.map.setBaseLayer(fixmystreet.map.layers[1]);
+ }, function(){
+ $(this).text('Stadtplan');
+ fixmystreet.map.setBaseLayer(fixmystreet.map.layers[0]);
+ });
+});
+
/*
* set_map_config() is called on dom ready in map-OpenLayers.js
* to setup the way the map should operate.
@@ -38,7 +48,7 @@
scales: [ '250000', '125000', '64000', '32000', '16000', '8000', '4000', '2000', '1000' ]
};
- fixmystreet.layer_options = {
+ var layer_options = {
projection: new OpenLayers.Projection("EPSG:21781"),
name: "Hybrid",
layer: "Hybrid",
@@ -60,11 +70,12 @@
]
};
fixmystreet.layer_options = [
- fixmystreet.layer_options, OpenLayers.Util.extend({}, fixmystreet.layer_options)
+ layer_options, OpenLayers.Util.applyDefaults({
+ name: "Stadtplan",
+ layer: "Stadtplan",
+ url: "http://www.wmts.stadt-zuerich.ch/Stadtplan/MapServer/WMTS/tile/"
+ }, layer_options)
];
- fixmystreet.layer_options[1].name = "Stadtplan";
- fixmystreet.layer_options[1].layer = "Stadtplan";
- fixmystreet.layer_options[1].url = "http://www.wmts.stadt-zuerich.ch/Stadtplan/MapServer/WMTS/tile/";
// Give main code a new bbox_strategy that translates between
// lat/lon and our swiss coordinates