Index: src/webapp/webclient/js/GnuBoat.js
===================================================================
--- src/webapp/webclient/js/GnuBoat.js	(revision e44e1f1d1f776cc63ee03dca5c3caa220b40c818)
+++ 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;
+	},
+};
Index: src/webapp/webclient/lib/js/leaflet.hotline.min.js
===================================================================
--- src/webapp/webclient/lib/js/leaflet.hotline.min.js	(revision fb91143047b67a6b6cc9972fa8198f4005fa1654)
+++ src/webapp/webclient/lib/js/leaflet.hotline.min.js	(revision fb91143047b67a6b6cc9972fa8198f4005fa1654)
@@ -0,0 +1,6 @@
+/*
+ (c) 2017, iosphere GmbH
+ Leaflet.hotline, a Leaflet plugin for drawing gradients along polylines.
+ https://github.com/iosphere/Leaflet.hotline/
+*/
+!function(t,i){"function"==typeof define&&define.amd?define(["leaflet"],i):"object"==typeof exports?module.exports=i:i(t.L)}(this,function(t){if(t.Hotline)return t;var i=function(t){if(!(this instanceof i))return new i(t);var e={0:"green",.5:"yellow",1:"red"};this._canvas=t="string"==typeof t?document.getElementById(t):t,this._ctx=t.getContext("2d"),this._width=t.width,this._height=t.height,this._weight=5,this._outlineWidth=1,this._outlineColor="black",this._min=0,this._max=1,this._data=[],this.palette(e)};i.prototype={width:function(t){return this._width=t,this},height:function(t){return this._height=t,this},weight:function(t){return this._weight=t,this},outlineWidth:function(t){return this._outlineWidth=t,this},outlineColor:function(t){return this._outlineColor=t,this},palette:function(t){var i=document.createElement("canvas"),e=i.getContext("2d"),n=e.createLinearGradient(0,0,0,256);i.width=1,i.height=256;for(var o in t)n.addColorStop(o,t[o]);return e.fillStyle=n,e.fillRect(0,0,1,256),this._palette=e.getImageData(0,0,1,256).data,this},min:function(t){return this._min=t,this},max:function(t){return this._max=t,this},data:function(t){return this._data=t,this},add:function(t){return this._data.push(t),this},draw:function(){var t=this._ctx;return t.globalCompositeOperation="source-over",t.lineCap="round",this._drawOutline(t),this._drawHotline(t),this},getRGBForValue:function(t){var i=Math.min(Math.max((t-this._min)/(this._max-this._min),0),.999),e=4*Math.floor(256*i);return[this._palette[e],this._palette[e+1],this._palette[e+2]]},_drawOutline:function(t){var i,e,n,o,h,r,s;if(this._outlineWidth)for(i=0,n=this._data.length;i<n;i++)for(o=this._data[i],t.lineWidth=this._weight+2*this._outlineWidth,e=1,h=o.length;e<h;e++)r=o[e-1],s=o[e],t.strokeStyle=this._outlineColor,t.beginPath(),t.moveTo(r.x,r.y),t.lineTo(s.x,s.y),t.stroke()},_drawHotline:function(t){var i,e,n,o,h,r,s,l,a,u;for(t.lineWidth=this._weight,i=0,n=this._data.length;i<n;i++)for(o=this._data[i],e=1,h=o.length;e<h;e++)r=o[e-1],s=o[e],l=t.createLinearGradient(r.x,r.y,s.x,s.y),a=this.getRGBForValue(r.z),u=this.getRGBForValue(s.z),l.addColorStop(0,"rgb("+a.join(",")+")"),l.addColorStop(1,"rgb("+u.join(",")+")"),t.strokeStyle=l,t.beginPath(),t.moveTo(r.x,r.y),t.lineTo(s.x,s.y),t.stroke()}};var e=t.Canvas.extend({_initContainer:function(){t.Canvas.prototype._initContainer.call(this),this._hotline=new i(this._container)},_update:function(){t.Canvas.prototype._update.call(this),this._hotline.width(this._container.width),this._hotline.height(this._container.height)},_updatePoly:function(t){if(this._drawing){var i=t._parts;i.length&&(this._updateOptions(t),this._hotline.data(i).draw())}},_updateOptions:function(t){null!=t.options.min&&this._hotline.min(t.options.min),null!=t.options.max&&this._hotline.max(t.options.max),null!=t.options.weight&&this._hotline.weight(t.options.weight),null!=t.options.outlineWidth&&this._hotline.outlineWidth(t.options.outlineWidth),null!=t.options.outlineColor&&this._hotline.outlineColor(t.options.outlineColor),t.options.palette&&this._hotline.palette(t.options.palette)}}),n=function(i){return t.Browser.canvas?new e(i):null},o={clipSegment:function(i,e,n,o,h){var r,s,l,a=o?this._lastCode:t.LineUtil._getBitCode(i,n),u=t.LineUtil._getBitCode(e,n);for(this._lastCode=u;;){if(!(a|u))return[i,e];if(a&u)return!1;r=a||u,s=t.LineUtil._getEdgeIntersection(i,e,r,n,h),l=t.LineUtil._getBitCode(s,n),r===a?(s.z=i.z,i=s,a=l):(s.z=e.z,e=s,u=l)}}};return t.Hotline=t.Polyline.extend({statics:{Renderer:e,renderer:n},options:{renderer:n(),min:0,max:1,palette:{0:"green",.5:"yellow",1:"red"},weight:5,outlineColor:"black",outlineWidth:1},getRGBForValue:function(t){return this._renderer._hotline.getRGBForValue(t)},_projectLatlngs:function(i,e,n){var o,h,r=i[0]instanceof t.LatLng,s=i.length;if(r){for(h=[],o=0;o<s;o++)h[o]=this._map.latLngToLayerPoint(i[o]),h[o].z=i[o].alt,n.extend(h[o]);e.push(h)}else for(o=0;o<s;o++)this._projectLatlngs(i[o],e,n)},_clipPoints:function(){if(this.options.noClip)return void(this._parts=this._rings);this._parts=[];var t,i,e,n,h,r,s,l=this._parts,a=this._renderer._bounds;for(t=0,e=0,n=this._rings.length;t<n;t++)for(s=this._rings[t],i=0,h=s.length;i<h-1;i++)r=o.clipSegment(s[i],s[i+1],a,i,!0),r&&(l[e]=l[e]||[],l[e].push(r[0]),r[1]===s[i+1]&&i!==h-2||(l[e].push(r[1]),e++))},_clickTolerance:function(){return this.options.weight/2+this.options.outlineWidth+(t.Browser.touch?10:0)}}),t.hotline=function(i,e){return new t.Hotline(i,e)},t});
