@@ -229,6 +229,19 @@ html, body {
229229 * Here because of the icon path
230230 */
231231
232+ var provider_mapping = {
233+ ' mapnik' : ' OpenStreetMap_Mapnik' ,
234+ ' blackandwhite' : ' OpenStreetMap_BlackAndWhite' ,
235+ ' mapnikfr' : ' OpenStreetMap_France' ,
236+ ' mapnikde' : ' OpenStreetMap_DE' ,
237+ ' mapnikhot' : ' OpenStreetMap_HOT' ,
238+ ' mapquest' : ' MapQuestOpen_OSM' ,
239+ ' mapquestaerial' : ' MapQuestOpen_Aerial' ,
240+ ' cloudmade' : ' CloudMade' ,
241+ ' toner' : ' Stamen_Toner' ,
242+ ' custom' : ' Custom' ,
243+ } ;
244+
232245var providers = { } ;
233246
234247providers['OpenStreetMap_Mapnik'] = {
@@ -249,6 +262,15 @@ providers['OpenStreetMap_BlackAndWhite'] = {
249262 } )
250263};
251264
265+ providers['OpenStreetMap_France'] = {
266+ title: ' osm fr' ,
267+ icon: ' https://a.tile.openstreetmap.fr/osmfr/5/15/11.png' ,
268+ layer: L.tileLayer(' https://{ s} .tile.openstreetmap.fr/osmfr/{ z} /{ x} /{ y} .png' , {
269+ maxZoom: 19,
270+ attribution: ' © Openstreetmap France | © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
271+ } )
272+ }
273+
252274providers['OpenStreetMap_DE'] = {
253275 title: ' osm de' ,
254276 icon: ' { /literal } { $OSM_PATH } {literal }leaflet/icons/openstreetmap_de.png',
@@ -258,6 +280,34 @@ providers['OpenStreetMap_DE'] = {
258280 } )
259281}
260282
283+ providers['OpenStreetMap_HOT'] = {
284+ title: ' osm HOT' ,
285+ icon: ' http://a.tile.openstreetmap.fr/hot/5/15/11.png' ,
286+ layer: L.tileLayer(' http://{ s} .tile.openstreetmap.fr/hot/{ z} /{ x} /{ y} .png' , {
287+ maxZoom: 19,
288+ attribution: ' © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>, Tiles courtesy of <a href="http://hot.openstreetmap.org/" target="_blank">Humanitarian OpenStreetMap Team</a>'
289+ } )
290+ }
291+
292+ providers['MapQuestOpen_OSM'] = {
293+ title: ' MapQuest' ,
294+ icon: ' http://otile1.mqcdn.com/tiles/1.0.0/map/5/15/11.png' ,
295+ layer: L.tileLayer(' http://otile{ s} .mqcdn.com/tiles/1.0.0/map/{ z} /{ x} /{ y} .png' , {
296+ maxZoom: 19,
297+ attribution: ' Tiles Courtesy of <a href="http://www.mapquest.com/">MapQuest</a> — Map data © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>' ,
298+ subdomains: ' 1234'
299+ } )
300+ }
301+
302+ providers['MapQuestOpen_Aerial'] = {
303+ title: ' MapQuest Aerial' ,
304+ icon: ' http://otile1.mqcdn.com/tiles/1.0.0/sat/5/15/11.png' ,
305+ layer: L.tileLayer(' http://otile{ s} .mqcdn.com/tiles/1.0.0/sat/{ z} /{ x} /{ y} .png' , {
306+ attribution: ' Tiles Courtesy of <a href="http://www.mapquest.com/">MapQuest</a> — Portions Courtesy NASA/JPL-Caltech and U.S. Depart. of Agriculture, Farm Service Agency' ,
307+ subdomains: ' 1234'
308+ } )
309+ }
310+
261311providers['Stamen_Toner'] = {
262312 title: ' toner' ,
263313 icon: ' { /literal } { $OSM_PATH } {literal }leaflet/icons/stamen_toner.png',
@@ -340,12 +390,32 @@ providers['CartoDB_Positron'] = {
340390 } )
341391};
342392
393+ { /literal }
394+ { if $default_baselayer == ' custom' }
395+ {literal }
396+ providers['Custom'] = {
397+ title: ' { /literal } { $custombaselayer } {literal }',
398+ icon: '{ /literal } { $iconbaselayer } {literal }',
399+ layer: L.tileLayer('{ /literal } { $custombaselayerurl } {literal }', {
400+ // The following attribution might be wrong
401+ // Please refer to https://leaflet-extras.github.io/leaflet-providers/preview/
402+ // to get the correct attribution notice.
403+ attribution: ' © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>' ,
404+ maxZoom: 19
405+ } )
406+ };
407+ { /literal }
408+ { /if }
409+ {literal }
410+
343411 /* BEGIN Leaflet-IconLayers https://github.com/ScanEx/Leaflet-IconLayers */
344412 var layers = [];
345413 for (var providerId in providers) {
346414 layers.push(providers[providerId]); // Providers from providers.js
347415 }
348- var ctrl = L.control.iconLayers(layers).addTo(map);
416+ var il = L.control.iconLayers(layers);
417+ il.setActiveLayer(providers[provider_mapping['{ /literal } { $default_baselayer } {literal }']].layer);
418+ var ctrl = il.addTo(map);
349419 /* END Leaflet-IconLayers */
350420
351421
0 commit comments