Index: src/webapp/webclient/js/GnuBoat.js
===================================================================
--- src/webapp/webclient/js/GnuBoat.js	(revision 79a1004bf5941846084db1c37a7766378a3eb268)
+++ src/webapp/webclient/js/GnuBoat.js	(revision fb91143047b67a6b6cc9972fa8198f4005fa1654)
@@ -230,7 +230,14 @@
 	map: null,
 	mapLayerCurrent: null,
-	// var mapControl = null;
+	mapPolylines: [],
+	mapControl: null,
 	mapsMetadata: null,
-	polyline: null,
+	dataMappings: {
+		speedthroughwater: {display: true, map: true, mapActive: false, titleLong: "Speed Through Water", titleShort: "STW", unit: "kts"},
+		speedoverground:  {display: true, map: true, mapActive: false, titleLong: "Speed Over Ground", titleShort: "SOG", unit: "kts"},
+		waterdepth: {display: true, map: true, mapActive: true, titleLong: "Waterdepth", titleShort: "Depth", unit: "m"},
+		watertemperature: {display: true, map: true, mapActive: false, titleLong: "Watertemperature", titleShort: "Water", unit: "°C"},
+		gpsfix: {display: true, map: false, mapActive: false, titleLong: "GPS Fix", titleShort: "Fix", unit: ""},
+	},
 	serverBaseUrl: null,
 	timerDisplay: null,
@@ -243,9 +250,14 @@
 	displayDataSet: function(data)
 	{
+		var keysDisplay = [];
+		for(var key in GnuBoat.private.dataMappings){
+			if(GnuBoat.private.dataMappings[key]["display"] === true)
+				keysDisplay.push(key);
+		}
 		if(!Array.isArray(data) && !(data instanceof Object)){
 			console.log("No data array returned!");
 			console.log(data);
 			return;
-			}
+		}
 		if(!("lastvalid" in data)){
 				console.log("No last valid values given!");
@@ -253,7 +265,6 @@
 		else{
 			var lastValid = data["lastvalid"];
-			var keys = ["speedthroughwater", "speedoverground", "waterdepth", "watertemperature", "gpsfix"];
-			for(var i = 0; i < keys.length; i++){
-				var key = keys[i];
+			for(var i = 0; i < keysDisplay.length; i++){
+				var key = keysDisplay[i];
 				var value = lastValid[key];
 				if($.isNumeric(value)){
@@ -262,8 +273,8 @@
 						text = value.toFixed(0);
 					}
-					$("#display #"+ keys[i] +" #value").text(text);
+					$("#display #"+ key +" #value").text(text);
 				}
 				else if(key == "gpsfix"){
-					$("#display #"+ keys[i] +" #value").text(value);
+					$("#display #"+ key +" #value").text(value);
 				}
 			}
@@ -279,16 +290,54 @@
 			else{
 				var track = data["track"];
+				var maximas = [];
+				var minimas = [];
 				var points = [];
+				
+				var keysMap = [];
+				for(var key in GnuBoat.private.dataMappings){
+					if(GnuBoat.private.dataMappings[key]["map"] === true)
+						keysMap.push(key);
+				}
+				for(var i = 0; i < keysMap.length; i++){
+					if(keysMap[i] == "gpsfix")
+						continue;
+					points[keysMap[i]] = [];
+				}
+				
+				// getting maximas, minimums for normalization and the tracks themselves
 				for(var time in track){
-					points.push(new L.latLng(track[time]["latitude"], track[time]["longitude"]));
-				}
-				if(points.length > 0){
-					if(!GnuBoat.private.polyline){
-						GnuBoat.private.polyline = L.polyline(points, {color: 'red'}).addTo(GnuBoat.private.map);
+					for(var i = 0; i < keysMap.length; i++){
+						var key = keysMap[i];
+						if(key == "gpsfix")
+							continue;
+						if(!(key in maximas))
+							maximas[key] = track[time][key]
+						else if(maximas[key] < track[time][key])
+							maximas[key] = track[time][key];
+						if(!(key in minimas))
+							minimas[key] = track[time][key]
+						else if(minimas[key] > track[time][key])
+							minimas[key] = track[time][key];
+						points[key].push(new L.latLng(track[time]["latitude"], track[time]["longitude"], track[time][key]));
 					}
-					else{
-						GnuBoat.private.polyline.setLatLngs(points);
+				}
+				for(var i = 0; i < keysMap.length; i++){
+					var key = keysMap[i];
+					if(key == "gpsfix")
+						continue;
+					if(points[key].length > 0){
+						if(key in GnuBoat.private.mapPolylines){
+							GnuBoat.private.mapPolylines[key].setLatLngs(points[key]);
+						}
+						else{
+							GnuBoat.private.mapPolylines[key] = L.hotline(points[key], {weight: 3, outlineWidth: 0, min: minimas[key], max: maximas[key]});
+							if(GnuBoat.private.mapControl){
+								var name = GnuBoat.private.dataMappings[key]["titleLong"] +" in "+ GnuBoat.private.dataMappings[key]["unit"] +" ("+ GnuBoat.private.dataMappings[key]["titleShort"] +")";
+								GnuBoat.private.mapControl.addOverlay(GnuBoat.private.mapPolylines[key], name);
+							}
+							if(GnuBoat.private.dataMappings[key]["mapActive"] === true)
+								GnuBoat.private.mapPolylines[key].addTo(GnuBoat.private.map);
+						}
 					}
-					GnuBoat.private.map.fitBounds(GnuBoat.private.polyline.getBounds());
 				}
 			}
@@ -334,4 +383,6 @@
 		if(GnuBoat.private.mapLayerCurrent != null){
 			GnuBoat.private.map.removeLayer(GnuBoat.private.mapLayerCurrent);
+			if(GnuBoat.private.mapControl)
+				GnuBoat.private.mapControl.removeLayer(GnuBoat.private.mapLayerCurrent);
 			GnuBoat.private.mapLayerCurrent = null;
 		}
@@ -342,4 +393,9 @@
 			opacity: 0.85
 			}).addTo(GnuBoat.private.map);
+		if(GnuBoat.private.mapControl)
+			GnuBoat.private.mapControl.addBaseLayer(GnuBoat.private.mapLayerCurrent, "Map");
+		else{
+			GnuBoat.private.mapControl = L.control.layers({"Map": GnuBoat.private.mapLayerCurrent}, GnuBoat.private.mapOverlaysToList(), {hideSingleBase: true, sortLayers: true, }).addTo(GnuBoat.private.map);
+		}
 	},
 	
@@ -358,3 +414,12 @@
 		$("#mapSelect").change(function(){ mapSetup(); });
 	},
-};
+	
+	mapOverlaysToList: function()
+	{
+		var overlays = {};
+		for(var key in GnuBoat.private.mapPolylines){
+			overlays[key] = GnuBoat.private.mapPolylines[key];
+		}
+		return overlays;
+	},
+};
