on master help sign in
[enh] template_oscar: add layer to leaflet map
commit3b7b106684a1dc899823bcef533e5892f7a813da authorThomas Pointhuber <thomas.pointhuber@gmx.at> dateMon 3 Nov 2014, 18:47 (12 years ago) parentc38917b
1 file changed+21−4
searx/static/oscar/js/scripts.js+21−4
searx/static/oscar/js/scripts.js+21−4
@@ -92,9 +92,17 @@ $(document).ready(function(){
9292 var map = L.map(leaflet_target);
9393
9494 // create the tile layer with correct attribution
95− var osmUrl='https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
96− var osmAttrib='Map data © <a href="https://openstreetmap.org">OpenStreetMap</a> contributors';
97− var osm = new L.TileLayer(osmUrl, {minZoom: 1, maxZoom: 19, attribution: osmAttrib});
95+ var osmMapnikUrl='https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
96+ var osmMapnikAttrib='Map data © <a href="https://openstreetmap.org">OpenStreetMap</a> contributors';
97+ var osmMapnik = new L.TileLayer(osmMapnikUrl, {minZoom: 1, maxZoom: 19, attribution: osmMapnikAttrib});
98+
99+ var osmMapquestUrl='http://otile{s}.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.jpg';
100+ var osmMapquestAttrib='Map data © <a href="https://openstreetmap.org">OpenStreetMap</a> contributors | Tiles Courtesy of <a href="http://www.mapquest.com/" target="_blank">MapQuest</a> <img src="http://developer.mapquest.com/content/osm/mq_logo.png">';
101+ var osmMapquest = new L.TileLayer(osmMapquestUrl, {minZoom: 1, maxZoom: 18, subdomains: '1234', attribution: osmMapquestAttrib});
102+
103+ var osmMapquestOpenAerialUrl='http://otile{s}.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.jpg';
104+ var osmMapquestOpenAerialAttrib='Map data © <a href="https://openstreetmap.org">OpenStreetMap</a> contributors | Tiles Courtesy of <a href="http://www.mapquest.com/" target="_blank">MapQuest</a> <img src="https://developer.mapquest.com/content/osm/mq_logo.png"> | Portions Courtesy NASA/JPL-Caltech and U.S. Depart. of Agriculture, Farm Service Agency';
105+ var osmMapquestOpenAerial = new L.TileLayer(osmMapquestOpenAerialUrl, {minZoom: 1, maxZoom: 11, subdomains: '1234', attribution: osmMapquestOpenAerialAttrib});
98106
99107 // init map view
100108 if(map_bounds) {
@@ -111,7 +119,16 @@ $(document).ready(function(){
111119 map.setView(new L.LatLng(map_lat, map_lon),8);
112120 }
113121
114− map.addLayer(osm);
122+ map.addLayer(osmMapnik);
123+
124+ var baseLayers = {
125+ "OSM Mapnik": osmMapnik,
126+ "MapQuest": osmMapquest/*,
127+ "MapQuest Open Aerial": osmMapquestOpenAerial*/
128+ };
129+
130+ L.control.layers(baseLayers).addTo(map);
131+
115132
116133 if(map_geojson)
117134 L.geoJson(map_geojson).addTo(map);