// Load Tile-Infos in Map

if( showtilenumbers > 0){
	
	function lookup(x, y, z) {
		return "x:"+x+"<br> y:"+y+"<br>zoom:"+z;
	}

	var GridInfo = L.GridLayer.extend({

		// called for each tile
		// returns a DOM node containing whatver ypu want
		createTile: function (coords) {

			// create a div
			var tile = document.createElement('div');
			tile.className = "infotile";
			tile.style.outline = '1px solid black';

			// lookup the piece of data you want
			var data = lookup(coords.x, coords.y, coords.z);

			// let's add the lat/lng of the center of the tile
			var tileBounds = this._tileCoordsToBounds(coords);
			var center = tileBounds.getCenter();

			tile.innerHTML = '<span>' + data+
				'<br>'+
				'lat:'+ center.lat+' '+'lng:'+center.lng+
			'</span>';

			return tile;
		}
	});

	map.addLayer(new GridInfo());	
	
	
}	
		




	
