// LAYER: ORTHOFOTOS + externe TILE-Layers

// Filter für die Pfade zu Tileservern, wie besondere URLs verlangen (z.B. ESRI - darf keine .png am Ende zu stehen haben
if( tile_layer_path[i].indexOf("{z}") >= 0){var path = tile_layer_path[i];}else{var path = tile_layer_path[i] + '/{z}/{x}/{y}.png';}

var attribution = tile_layer_attribution[i];
var minZoom = tile_layer_minZoom[i];
var maxZoom = tile_layer_maxZoom[i];
var maxNativeZoom = tile_layer_maxNativeZoom[i];

// var slider = tile_layer_slider[i];
 if(tile_layer_slider[i] == 0){var slider = "none";}else{var slider = "";}

var icon = tile_layer_icon[i];
var pane = 'pane_TILES_' + i
var title = "<span class='fa " + icon + "' style='color:red'></span> " + tile_layer_title[i] + "<input id='slider' style='display:" + slider + ";'  type='range' min='0' max='1' step='0.1' value='1' oninput='roy" + i + ".setOpacity(this.value)'>"; 

		
	map.createPane(pane);
	map.getPane(pane).style.zIndex = tile_layer[i];
	// Erzeugung eines dynamischen Variablen-Namen (roy0...roy3)
		window['roy'+i]  = L.tileLayer(path, {
			pane: pane,
			opacity: 1.0,
			attribution: attribution,
			minZoom: minZoom,
			maxZoom: maxZoom,
			minNativeZoom: 0,
			maxNativeZoom: maxNativeZoom
		});
		
		if( tile_layer_status[i] > 0) { map.addLayer(window['roy'+i]);}

		L.control.layers(baseMaps,{
		[title]: window['roy'+i],
			},{collapsed:false}).addTo(map);	
	
i = i + 1;
	
	
