Selaa lähdekoodia

[enh] template_oscar: add layer to leaflet map

Thomas Pointhuber 10 vuotta sitten
vanhempi
commit
3b7b106684
1 muutettua tiedostoa jossa 21 lisäystä ja 4 poistoa
  1. 21
    4
      searx/static/oscar/js/scripts.js

+ 21
- 4
searx/static/oscar/js/scripts.js Näytä tiedosto

@@ -92,9 +92,17 @@ $(document).ready(function(){
92 92
             var map = L.map(leaflet_target);
93 93
 
94 94
             // 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});
98 106
 
99 107
             // init map view
100 108
             if(map_bounds) {
@@ -111,7 +119,16 @@ $(document).ready(function(){
111 119
                     map.setView(new L.LatLng(map_lat, map_lon),8);
112 120
             }
113 121
 
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
+
115 132
 
116 133
             if(map_geojson)
117 134
                 L.geoJson(map_geojson).addTo(map);