commit: 3b7b106684a1dc899823bcef533e5892f7a813da
parent c38917bb2a472429f78cd00fffb5e7057ceecc02
Author: Thomas Pointhuber <thomas.pointhuber@gmx.at>
Date: Mon, 3 Nov 2014 18:47:18 +0100
[enh] template_oscar: add layer to leaflet map
Diffstat:
1 file changed, 21 insertions(+), 4 deletions(-)
diff --git a/searx/static/oscar/js/scripts.js b/searx/static/oscar/js/scripts.js
@@ -92,9 +92,17 @@ $(document).ready(function(){
var map = L.map(leaflet_target);
// create the tile layer with correct attribution
- var osmUrl='https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
- var osmAttrib='Map data © <a href="https://openstreetmap.org">OpenStreetMap</a> contributors';
- var osm = new L.TileLayer(osmUrl, {minZoom: 1, maxZoom: 19, attribution: osmAttrib});
+ var osmMapnikUrl='https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
+ var osmMapnikAttrib='Map data © <a href="https://openstreetmap.org">OpenStreetMap</a> contributors';
+ var osmMapnik = new L.TileLayer(osmMapnikUrl, {minZoom: 1, maxZoom: 19, attribution: osmMapnikAttrib});
+
+ var osmMapquestUrl='http://otile{s}.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.jpg';
+ 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">';
+ var osmMapquest = new L.TileLayer(osmMapquestUrl, {minZoom: 1, maxZoom: 18, subdomains: '1234', attribution: osmMapquestAttrib});
+
+ var osmMapquestOpenAerialUrl='http://otile{s}.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.jpg';
+ 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';
+ var osmMapquestOpenAerial = new L.TileLayer(osmMapquestOpenAerialUrl, {minZoom: 1, maxZoom: 11, subdomains: '1234', attribution: osmMapquestOpenAerialAttrib});
// init map view
if(map_bounds) {
@@ -111,7 +119,16 @@ $(document).ready(function(){
map.setView(new L.LatLng(map_lat, map_lon),8);
}
- map.addLayer(osm);
+ map.addLayer(osmMapnik);
+
+ var baseLayers = {
+ "OSM Mapnik": osmMapnik,
+ "MapQuest": osmMapquest/*,
+ "MapQuest Open Aerial": osmMapquestOpenAerial*/
+ };
+
+ L.control.layers(baseLayers).addTo(map);
+
if(map_geojson)
L.geoJson(map_geojson).addTo(map);