Index: src/webapp/webservice/inc/GnuBoat/Config.php
===================================================================
--- src/webapp/webservice/inc/GnuBoat/Config.php	(revision 86442cbd127610871a5571fd03379f0aaad8704f)
+++ src/webapp/webservice/inc/GnuBoat/Config.php	(revision 008bce99c15e3dad6fcf395f8c3a3f69b23b4b28)
@@ -26,5 +26,5 @@
 	public function __construct()
 	{
-		$configFile = __DIR__ ."/../config/config.php";
+		$configFile = __DIR__ ."/../../config/config.php";
 		if(file_exists($configFile)){
 			include($configFile);
@@ -51,5 +51,5 @@
 	{
 		if(array_key_exists("datadirectory", $this->_config))
-			return addTrailingSlash($this->_config["datadirectory"]);
+			return $this->addTrailingSlash($this->_config["datadirectory"]);
 		return "/var/lib/gnuboat/";
 	}
@@ -58,5 +58,5 @@
 	{
 		if(array_key_exists("logdirectory", $this->_config))
-			return addTrailingSlash($this->_config["logdirectory"]);
+			return $this->addTrailingSlash($this->_config["logdirectory"]);
 		return "/var/log/gnuboat/";
 	}
Index: src/webapp/webservice/inc/GnuBoat/Nmea/Nmea0183/Nmea0183Dpt.php
===================================================================
--- src/webapp/webservice/inc/GnuBoat/Nmea/Nmea0183/Nmea0183Dpt.php	(revision 86442cbd127610871a5571fd03379f0aaad8704f)
+++ src/webapp/webservice/inc/GnuBoat/Nmea/Nmea0183/Nmea0183Dpt.php	(revision 008bce99c15e3dad6fcf395f8c3a3f69b23b4b28)
@@ -33,5 +33,5 @@
 			return;
 		
-		$this->_depth = $content[1];
+		$this->_depth = (float)$content[1];
 		$tmp = explode("*", $content[2]);
 		$this->_offset = $tmp[0];
Index: src/webapp/webservice/inc/GnuBoat/Nmea/Nmea0183/Nmea0183Mtw.php
===================================================================
--- src/webapp/webservice/inc/GnuBoat/Nmea/Nmea0183/Nmea0183Mtw.php	(revision 86442cbd127610871a5571fd03379f0aaad8704f)
+++ src/webapp/webservice/inc/GnuBoat/Nmea/Nmea0183/Nmea0183Mtw.php	(revision 008bce99c15e3dad6fcf395f8c3a3f69b23b4b28)
@@ -33,5 +33,5 @@
 			return;
 		
-		$this->_temperature = $content[1];
+		$this->_temperature = (float)$content[1];
 		$tmp = explode("*", $content[2]);
 		$this->_unit = $tmp[0];
Index: src/webapp/webservice/inc/GnuBoat/Nmea/Nmea0183/Nmea0183Rmc.php
===================================================================
--- src/webapp/webservice/inc/GnuBoat/Nmea/Nmea0183/Nmea0183Rmc.php	(revision 86442cbd127610871a5571fd03379f0aaad8704f)
+++ src/webapp/webservice/inc/GnuBoat/Nmea/Nmea0183/Nmea0183Rmc.php	(revision 008bce99c15e3dad6fcf395f8c3a3f69b23b4b28)
@@ -19,4 +19,9 @@
 namespace GnuBoat\Nmea\Nmea0183;
 
+/**
+ * @brief NMEA0183 RMC Naviation sentence
+ *
+ * Keep in mind, that the latitude() and longitude() is converted to +/- values
+ */
 class Nmea0183Rmc extends Nmea0183Sentence
 {
@@ -49,16 +54,18 @@
 		if($content[2] == 'A')
 			$this->_status = Nmea0183RmcStatus::A;
-			
-		$this->_latitude = $content[3];
-		$this->_latitudeDirection = Nmea0183Rmc::directionToEnum($content[4]);
 		
-		$this->_longitude = $content[5];
-		$this->_longitudeDirection = Nmea0183Rmc::directionToEnum($content[6]);
+		$this->_latitude = (float)$content[3];
+		if(Nmea0183Rmc::directionToEnum($content[4]) == Nmea0183Direction::South)
+			$this->_latitude = $this->_latitude * -1;
 		
-		$this->_speedOverGround = $content[7];
+		$this->_longitude = (float)$content[5];
+		if(Nmea0183Rmc::directionToEnum($content[6]) == Nmea0183Direction::West)
+			$this->_longitude = $this->_longitude * -1;
 		
-		$this->_courseOverGround = $content[8];
+		$this->_speedOverGround = (float)$content[7];
 		
-		$this->_magneticDeclination = $content[10];
+		$this->_courseOverGround = (float)$content[8];
+		
+		$this->_magneticDeclination = (float)$content[10];
 		$this->_magneticDeclinationDirection = Nmea0183Rmc::directionToEnum($content[11]);
 		
@@ -82,4 +89,7 @@
 	}
 	
+	/**
+	 * @brief Latitude with North (+) and South (-)
+	 */
 	public function latitude()
 	{
@@ -87,17 +97,10 @@
 	}
 	
-	public function latitudeDirection()
-	{
-		return $this->_latitudeDirection;
-	}
-	
+	/**
+	 * @brief Longitude with East (+) and West (-)
+	 */
 	public function longitude()
 	{
 		return $this->_longitude;
-	}
-
-	public function longitudeDirection()
-	{
-		return $this->_longitudeDirection;
 	}
 	
@@ -162,7 +165,5 @@
 	private $_status;
 	private $_latitude;
-	private $_latitudeDirection;
 	private $_longitude;
-	private $_longitudeDirection;
 	private $_speedOverGround;
 	private $_courseOverGround;
Index: src/webapp/webservice/inc/GnuBoat/Nmea/Nmea0183/Parser.php
===================================================================
--- src/webapp/webservice/inc/GnuBoat/Nmea/Nmea0183/Parser.php	(revision 86442cbd127610871a5571fd03379f0aaad8704f)
+++ src/webapp/webservice/inc/GnuBoat/Nmea/Nmea0183/Parser.php	(revision 008bce99c15e3dad6fcf395f8c3a3f69b23b4b28)
@@ -35,8 +35,8 @@
 		$result = array();
 		if(!file_exists($file)){
-			$message = "NMEA file to parse does not exists: ". $file ."\n";
+			$message = "NMEA file to parse does not exists: ". $file;
 			error_log($message);
 			if($debug > 0)
-				print $message;
+				print $message ."\n";
 			return $result;
 		}
@@ -44,8 +44,8 @@
 		$fileHandler = fopen($file, 'r');
 		if(!$fileHandler){
-			$message = "NMEA file to parse could not be opend for reading: ". $file ."\n";
+			$message = "NMEA file to parse could not be opend for reading: ". $file;
 			error_log($message);
 			if($debug > 0)
-				print $message;
+				print $message ."\n";
 			return $result;
 		}
@@ -61,8 +61,8 @@
 				$result[] = $parsedSentence;
 			else{
-				$message = "Skipped sentence on line ". $line .": ". $sentence ."\n";
+				$message = "Skipped sentence on line ". $line .": ". $sentence;
 				error_log($message);
 				if($debug > 0)
-					print $message;
+					print $message ."\n";
 			}
 		}
@@ -75,8 +75,8 @@
 		$sentence = trim($sentence);
 		if(empty($sentence)){
-			$message = "Empty sentence\n";
+			$message = "Empty sentence";
 			error_log($message);
 			if($debug > 0)
-				print $message;
+				print $message ."\n";
 			return null;
 		}
@@ -85,8 +85,8 @@
 		$result = preg_match('/^[\$!]{1}([\w]{2})([\w]{3})([^\*]+)\*([\da-zA-Z]+)$/', $sentence, $matches);
 		if($result === false || $result != 1 || count($matches) != 5){
-			$message = "Could not detect talker, type and checksum from ". $sentence ."\n";
+			$message = "Could not detect talker, type and checksum from ". $sentence;
 			error_log($message);
 			if($debug > 0)
-				print $message;
+				print $message ."\n";
 			return null;
 		}
@@ -97,8 +97,8 @@
 		
 		if(!array_key_exists(strtolower($type), $this->_types)){
-			$message = "Skipping unknown NMEA0183 sentence of type ". $type .": ". $sentence ."\n";
+			$message = "Skipping unknown NMEA0183 sentence of type ". $type .": ". $sentence;
 			error_log($message);
 			if($debug > 0)
-				print $message;
+				print $message ."\n";
 			return null;
 		}
Index: src/webapp/webservice/inc/GnuBoat/Nmea/NmeaSentence.php
===================================================================
--- src/webapp/webservice/inc/GnuBoat/Nmea/NmeaSentence.php	(revision 86442cbd127610871a5571fd03379f0aaad8704f)
+++ src/webapp/webservice/inc/GnuBoat/Nmea/NmeaSentence.php	(revision 008bce99c15e3dad6fcf395f8c3a3f69b23b4b28)
@@ -48,5 +48,5 @@
 	public function type()
 	{
-		return $this->_type;
+		return strtolower($this->_type);
 	}
 	
Index: src/webapp/webservice/inc/GnuBoat/Service.php
===================================================================
--- src/webapp/webservice/inc/GnuBoat/Service.php	(revision 86442cbd127610871a5571fd03379f0aaad8704f)
+++ src/webapp/webservice/inc/GnuBoat/Service.php	(revision 008bce99c15e3dad6fcf395f8c3a3f69b23b4b28)
@@ -44,4 +44,15 @@
 		$this->process();
 	}
+	
+	public static function error($message)
+	{
+		Service::output(["error" => 1, "errormessage" => $message]);
+	}
+	
+	public static function output($content)
+	{
+		header('Content-Type: application/json');
+		echo json_encode($content);
+	}
 
 	/**
Index: src/webapp/webservice/inc/GnuBoat/ServiceData.php
===================================================================
--- src/webapp/webservice/inc/GnuBoat/ServiceData.php	(revision 86442cbd127610871a5571fd03379f0aaad8704f)
+++ src/webapp/webservice/inc/GnuBoat/ServiceData.php	(revision 008bce99c15e3dad6fcf395f8c3a3f69b23b4b28)
@@ -49,9 +49,8 @@
 
 		if(!file_exists($dbFile)){
-			echo json_encode("");
 			if($debug > 0)
 				echo "Database file ". $dbFile ." does not exist!";
 			error_log("Database file ". $dbFile ." does not exist");
-			exit;
+			return;
 		}
 		// Fetch entries of the last 30s with maximum (available) resolution of 2s
Index: src/webapp/webservice/inc/GnuBoat/ServiceLogFiles.php
===================================================================
--- src/webapp/webservice/inc/GnuBoat/ServiceLogFiles.php	(revision 86442cbd127610871a5571fd03379f0aaad8704f)
+++ src/webapp/webservice/inc/GnuBoat/ServiceLogFiles.php	(revision 008bce99c15e3dad6fcf395f8c3a3f69b23b4b28)
@@ -32,4 +32,6 @@
 		$debug = $this->debug();
 		$config = new Config();
+		if($debug > 1)
+			print "Log directory: ". $config->logDirectory() ."\n";
 
 		if(!array_key_exists("logfilesSelected", $_POST)){
Index: src/webapp/webservice/inc/GnuBoat/ServiceReplay.php
===================================================================
--- src/webapp/webservice/inc/GnuBoat/ServiceReplay.php	(revision 008bce99c15e3dad6fcf395f8c3a3f69b23b4b28)
+++ src/webapp/webservice/inc/GnuBoat/ServiceReplay.php	(revision 008bce99c15e3dad6fcf395f8c3a3f69b23b4b28)
@@ -0,0 +1,79 @@
+<?php
+/*
+    Copyright (C) 2017 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+namespace GnuBoat;
+
+require_once(__DIR__ ."/../autoloader.php");
+
+class ServiceReplay extends Service
+{
+	function __construct()
+	{
+		parent::__construct();
+	}
+
+	protected function process()
+	{
+		$debug = $this->debug();
+		$config = new Config();
+		if($debug > 1)
+			print "Log directory: ". $config->logDirectory() ."\n";
+
+		if(!array_key_exists("logfile", $_POST)){
+			return $this->error("No logfile to replay selected");
+		}
+
+		// prepare a download of available log files
+		$file = $config->logDirectory() . $_POST["logfile"];
+		if(!file_exists($file))
+			return $this->error("Logfile ". $file ." not found");
+		
+		$parser = new Nmea\Parser();
+		$nmeaSentences = $parser->parseFile($file, '0183');
+		if($nmeaSentences == null)
+			return error("Error parsing logfile ". $file);
+		
+		$result = ["track" => []];
+		$currentItem = new TrackItem();
+		foreach($nmeaSentences as $sentence){
+			if($sentence->type() == "rmc"){
+				if($currentItem->isValid()){
+					$result["track"][$currentItem->timestamp()] = $currentItem->toArray();
+					$currentItem = new TrackItem();
+				}
+				$currentItem->setDateTime($sentence->dateTime());
+				$currentItem->setLatitude($sentence->latitude());
+				$currentItem->setLongitude($sentence->longitude());
+				$currentItem->setSpeedOverGround($sentence->speedOverGround());
+				$currentItem->setCourseOverGround($sentence->courseOverGround());
+			}
+			elseif($sentence->type() == "dpt"){
+				$currentItem->setWaterDepth($sentence->depth());
+			}
+			elseif($sentence->type() == "mtw"){
+				$currentItem->setWaterTemperature($sentence->temperature());
+			}
+		}
+		if($currentItem->isValid())
+			$result["track"][$currentItem->timestamp()] = $currentItem->toArray();
+
+		$this->output($result);
+	}
+}
+
+?>
Index: src/webapp/webservice/inc/GnuBoat/TrackItem.php
===================================================================
--- src/webapp/webservice/inc/GnuBoat/TrackItem.php	(revision 008bce99c15e3dad6fcf395f8c3a3f69b23b4b28)
+++ src/webapp/webservice/inc/GnuBoat/TrackItem.php	(revision 008bce99c15e3dad6fcf395f8c3a3f69b23b4b28)
@@ -0,0 +1,177 @@
+<?php
+/*
+    Copyright (C) 2017 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+namespace GnuBoat;
+
+/**
+  * @brief One item in a track
+  */
+class TrackItem
+{
+	function __construct()
+	{
+		$this->_time = null;
+		$this->_latitude = null;
+		$this->_longitude = null;
+		$this->_speedThroughWater = null;
+		$this->_speedOverGround = null;
+		$this->_courseOverGround = null;
+		$this->_waterDepth = null;
+		$this->_waterTemperature = null;
+		$this->_gpsfix = null;
+	}
+
+	public function setTimestamp($time)
+	{
+		$this->_time = $time;
+	}
+	
+	public function setDateTime($dateTime)
+	{
+		$timezone = new \DateTimeZone("UTC");
+		if($dateTime == null)
+			$this->_time = null;
+		$dateTime->setTimezone($timezone);
+		$this->_time = $dateTime->getTimestamp();
+	}
+	
+	public function timestamp()
+	{
+		return $this->_time;
+	}
+	
+		public function setLatitude($latitude)
+	{
+		$this->_latitude = $latitude;
+	}
+	
+	public function latitude()
+	{
+		return $this->_latitude;
+	}
+	
+		public function setLongitude($longitude)
+	{
+		$this->_longitude = $longitude;
+	}
+	
+	public function longitude()
+	{
+		return $this->_longitude;
+	}
+	
+		public function setSpeedThroughWater($speedThroughWater)
+	{
+		$this->_speedThroughWater = $speedThroughWater;
+	}
+	
+	public function speedThroughWater()
+	{
+		return $this->_speedThroughWater;
+	}
+	
+		public function setSpeedOverGround($speedOverGround)
+	{
+		$this->_speedOverGround = $speedOverGround;
+	}
+	
+	public function speedOverGround()
+	{
+		return $this->_speedOverGround;
+	}
+	
+		public function setCourseOverGround($courseOverGround)
+	{
+		$this->_courseOverGround = $courseOverGround;
+	}
+	
+	public function courseOverGround()
+	{
+		return $this->_courseOverGround;
+	}
+	
+		public function setWaterDepth($waterDepth)
+	{
+		$this->_waterDepth = $waterDepth;
+	}
+	
+	public function waterDepth()
+	{
+		return $this->_waterDepth;
+	}
+	
+		public function setWaterTemperature($waterTemperature)
+	{
+		$this->_waterTemperature = $waterTemperature;
+	}
+	
+	public function waterTemperature()
+	{
+		return $this->_waterTemperature;
+	}
+	
+		public function setGpsFix($gpsFix)
+	{
+		$this->_gpsFix = $gpsFix;
+	}
+	
+	public function gpsFix()
+	{
+		return $this->_gpsFix;
+	}
+	
+	public function isValid()
+	{
+		if($this->timestamp() == null)
+			return false;
+		if($this->latitude() == null)
+			return false;
+		if($this->longitude() == null)
+			return false;
+		return true;
+	}
+	
+	public function toArray()
+	{
+		$speedThroughWater = ($this->speedThroughWater() != null) ? $this->speedThroughWater() : 0;
+		$speedOverGround = ($this->speedOverGround() != null) ? $this->speedOverGround() : 0;
+		$courseOverGround = ($this->courseOverGround() != null) ? $this->courseOverGround() : 0;
+		$waterDepth = ($this->waterDepth() != null) ? $this->waterDepth() : 0;
+		$waterTemperature = ($this->waterTemperature() != null) ? $this->waterTemperature() : 0;
+		$gpsFix = ($this->gpsFix() != null) ? $this->gpsFix() : 0;
+	
+		return [
+			"latitude" => $this->latitude(),
+			"longitude" => $this->longitude(),
+			"speedthroughwater" => $speedThroughWater,
+			"speedoverground" => $speedOverGround,
+			"courseoverground" => $courseOverGround,
+			"waterdepth" => $waterDepth,
+			"watertemperature" => $waterTemperature,
+			"gpsfix" => $gpsFix,
+		];
+	}
+
+	private $_time;
+	private $_latitude, $_longitude;
+	private $_speedThroughWater, $_speedOverGround, $_courseOverGround;
+	private $_waterDepth, $_waterTemperature;
+	private $_gpsFix;
+}
+
+?>
Index: src/webapp/webservice/inc/GnuBoat/Webservice.php
===================================================================
--- src/webapp/webservice/inc/GnuBoat/Webservice.php	(revision 86442cbd127610871a5571fd03379f0aaad8704f)
+++ src/webapp/webservice/inc/GnuBoat/Webservice.php	(revision 008bce99c15e3dad6fcf395f8c3a3f69b23b4b28)
@@ -23,5 +23,5 @@
 class WebService
 {
-	function __construct()
+	function __construct($debug)
 	{
 		$this->_requests = array();
@@ -30,12 +30,11 @@
 		$this->_requests["logfiles"] = "GnuBoat\ServiceLogFiles";
 		$this->_requests["map"] = "GnuBoat\ServiceMap";
+		$this->_requests["replay"] = "GnuBoat\ServiceReplay";
+		
+		$this->_debug = $debug;
 	}
 
 	public function process()
 	{
-		$debug = 0;
-		if(is_array($_GET) && array_key_exists("debug", $_GET))
-			$debug = $_GET["debug"];
-
 		$request = array_keys($this->_requests)[0];
 		if(is_array($_GET) && array_key_exists("request", $_GET)){
@@ -44,16 +43,12 @@
 
 		if(!array_key_exists($request, $this->_requests)){
-			$result["error"] = 1;
-			$result["errormessage"] = "Request ". $request ." not implemented";
-			
-			header('Content-Type: application/json');
-			echo json_encode($result) ."\n";
-			return;
+			return Service::error("Request ". $request ." not implemented");
 		}
-
-		call_user_func(array(new $this->_requests[$request], "processRequest"), $debug);
+		
+		call_user_func(array(new $this->_requests[$request], "processRequest"), $this->_debug);
 	}
 
 	private $_requests;
+	private $_debug;
 }
 
