Browse Source

init django app

subDesTagesMitExtraKaese 2 years ago
parent
commit
21267ce51e
18 changed files with 103 additions and 1126 deletions
  1. 1 0
      .gitignore
  2. 0 1
      .htaccess
  3. 22 0
      README.md
  4. 0 0
      __init__.py
  5. 3 0
      admin.py
  6. 6 0
      apps.py
  7. 0 44
      gps_ajax.php
  8. 0 270
      gps_filter.php
  9. 0 173
      gps_insert.php
  10. 0 139
      gps_logger_to_serial_csv.ino
  11. 0 60
      index.php
  12. 45 0
      migrations/0001_initial.py
  13. 0 0
      migrations/__init__.py
  14. 20 0
      models.py
  15. 0 391
      nmea_parser.php
  16. 0 48
      table.sql
  17. 3 0
      tests.py
  18. 3 0
      views.py

+ 1 - 0
.gitignore

@@ -0,0 +1 @@
+__pycache__/

+ 0 - 1
.htaccess

@@ -1 +0,0 @@
-Header set Content-Security-Policy "script-src 'self' 'unsafe-inline' 'unsafe-eval' https://dev.virtualearth.net https://maps.googleapis.com/; object-src 'self'; form-action 'self'; worker-src 'self'"

+ 22 - 0
README.md

@@ -0,0 +1,22 @@
+# GPS-Logger
+
+## Features
+
+- 3D Map with GPS-Tracking data
+- automatic partitioning into tracks
+- charts of speed and height profiles
+- ingest of Arduino csv files and generic NMEA files
+- data optimization with RamerDouglasPeucker2d algorithm
+- censoring of sensitive coordinates 
+
+## Roadmap
+
+- [X] Database
+- [X] Clientside JS
+- [X] Stylesheets
+- [ ] Port to Django
+  - [X] Data Models
+  - [ ] Public view
+  - [ ] Authenticated gps ingestion
+  - [ ] Urls
+  - [ ] Tests

+ 0 - 0
__init__.py


+ 3 - 0
admin.py

@@ -0,0 +1,3 @@
+from django.contrib import admin
+
+# Register your models here.

+ 6 - 0
apps.py

@@ -0,0 +1,6 @@
+from django.apps import AppConfig
+
+
+class GpsLoggerConfig(AppConfig):
+    default_auto_field = 'django.db.models.BigAutoField'
+    name = 'gps_logger'

+ 0 - 44
gps_ajax.php

@@ -1,44 +0,0 @@
-<?php
-ini_set("display_errors", "0");
-//error_reporting(E_ALL);
-date_default_timezone_set('UTC');
-require("connection.php");
-// Opens a connection to a MySQL server
-$db = new PDO("mysql:host=$dbhost;dbname=$db;charset=utf8mb4", $dbuser, $dbpass);
-$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
-$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
-
-$cache_file = "data.txt";
-
-$query = "SHOW TABLE STATUS FROM arduino LIKE 'markers'";
-$stmt = $db->query($query);
-$row = $stmt->fetch(PDO::FETCH_ASSOC);
-	
-if (file_exists($cache_file) && strtotime($row['Update_time']) <= filemtime ($cache_file)) {
-	
-	header("Location: $cache_file?cache=" . filemtime ($cache_file));
-	die();
-
-} else {
-	// Select all the rows in the markers table
-	$query = "SELECT * FROM markers ORDER BY timestamp";
-	$stmt = $db->query($query);
-	// Iterate through the rows, adding XML nodes for each
-	while($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
-		$row['lat'] = doubleval($row['lat']);
-		$row['lng'] = doubleval($row['lng']);
-		$row['alt'] = floatval($row['alt']);
-		$row['hdop'] = intval($row['hdop']);
-		$row['timestamp'] = strtotime($row['timestamp']);
-		//$row['format'] = date('d.m.Y H:i:s', $row['timestamp']);
-		$json[] = $row;
-	}
-
-	$txt=json_encode($json);
-	file_put_contents($cache_file, $txt, LOCK_EX);
-	echo $txt;
-}
-
-
-
-?>

+ 0 - 270
gps_filter.php

@@ -1,270 +0,0 @@
-<?php
-ini_set("display_errors", "1");
-error_reporting(E_ALL);
-require("connection.php");
-
-$db = new PDO("mysql:host=$dbhost;dbname=$db;charset=utf8mb4", $dbuser, $dbpass);
-$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
-$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
-
-$coords = Array(
-	Array(123.45, -13.45),//some coodinates to remove from database
-);
-$distance = 800 / 111139.0; // m / (m/deg) 
-
-$json = Array();
-
-foreach($coords as $coord) {
-	$stmt = $db->prepare("SELECT *, SQRT(POW(ABS(? - lat),2) + POW(ABS(? - lng),2)) AS distance FROM markers WHERE POW(ABS(? - lat),2) + POW(ABS(? - lng),2) < POW(?,2) ORDER BY timestamp");
-	//$stmt->bindParam(":lat", $coord[0]);
-	//$stmt->bindParam(":lng", $coord[1]);
-	//$stmt->bindParam(":dist", $distance);
-	$stmt->execute(Array($coord[0],$coord[1],$coord[0],$coord[1],$distance));
-	
-	while($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
-		$row['lat'] = doubleval($row['lat']);
-		$row['lng'] = doubleval($row['lng']);
-		$row['alt'] = floatval($row['alt']);
-		$row['hdop'] = intval($row['hdop']);
-		$row['timestamp'] = strtotime($row['timestamp']);
-		$row['format'] = date('d.m.Y H:i:s', $row['timestamp']);
-		$json[] = $row;
-	}
-	$stmt = $db->prepare("DELETE FROM markers WHERE POW(ABS(? - lat),2) + POW(ABS(? - lng),2) < POW(?,2) ORDER BY timestamp");
-	$stmt->execute(Array($coord[0],$coord[1],$distance));
-}
-
-?>
-
-<!DOCTYPE html >
-  <head>
-    <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
-    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
-    <title>Arduino/PHP/MySQL & Google Maps</title>
-		<script language="javascript" type="text/javascript" src="../flot/jquery.js"></script>
-    <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyA0ugZma4Wf5vweeAfy5uulSY_tpPt2bFs"
-            type="text/javascript"></script>
-								<style>
-			.info {
-				border-radius: 25px;
-				opacity: .8;
-				padding: 5px;
-				margin: 5px;
-				display: inline-block;
-				background-color: #8383ff;
-				text-align: center;
-        cursor: pointer;
-    
-        animation: fadein 1.2s;
-			}
-      @keyframes fadein {
-        from { opacity: 0; }
-        to   { opacity: .8; }
-      }
-		</style>
-<script type="text/javascript">
-		$(window).resize(function() {
-		$('#map').height($(window).height());
-		$('#map').width($(window).width());
-	});
-function load() {
-			$('#map').height($(window).height());
-			$('#map').width($(window).width());
-		var map = new google.maps.Map(document.getElementById("map"), {
-			center: new google.maps.LatLng(51.9907479, 11.1171459),
-			zoom: 6,
-			mapTypeId: 'hybrid'
-		});
-		var bikeLayer = new google.maps.BicyclingLayer();
-		bikeLayer.setMap(map);
-		var infoWindow = new google.maps.InfoWindow;
-		var geocoder = new google.maps.Geocoder;
-		
-		var data = JSON.parse('<?php echo json_encode($json); ?>');
-		var startIndex = 0, distances = [0], timeDiff = [1], timeMovement = 0, speed = [0], up = 0, down = 0;
-		var tripDist = 0, tripIndex = 0;
-		
-		for (var i = 1; i < data.length; i++) {
-
-			distances[i] = distance(data[i-1].lat, data[i-1].lng, data[i].lat, data[i].lng);
-			if(isNaN(distances[i])) distances[i] = 0;
-			timeDiff[i] = data[i].timestamp - data[i-1].timestamp;
-			
-			if(data[i].speed != null) {
-				speed[i] = data[i].speed * 1.852 / 100;
-			} else {
-				speed[i] = distances[i] / timeDiff[i] * 3.6;
-			}
-
-			if(timeDiff[i] > 60*30 || i == data.length - 1) {
-				
-				var color = getRandomColor(i);
-				var dis = distances.slice(startIndex+1, i).reduce((a, b) => a + b, 0);
-				var tsp = Math.max.apply(Math, speed.slice(startIndex+1, i)).toFixed(1);
-				var avg = (dis / timeMovement * 3.6).toFixed(2);
-				var html = "Start: <b>" + data[startIndex].format + 
-					"</b><br/>Finish: <b>" + data[i-1].format + "</b><br/>" +
-					"Track time (full): "+ timeFormat(data[i-1].timestamp-data[startIndex].timestamp) + "<br>" +
-					"Track time (movement): "+ timeFormat(timeMovement) + "<br>" +
-					"<a target='_blank'  href='gps_graph.php?start="+startIndex+"&finish="+i+
-					"'>Alt:</a> &uarr;" + up.toFixed(1) + "m  &darr;" + down.toFixed(1) + "m"+
-					"<br/>Distance: "+(dis/1000).toFixed(1)+"km<br/>" +
-					"top speed: "+tsp+
-					"km/h<br/><a target='_blank' href='gps_graph.php?start="+startIndex+"&finish="+i+
-					"'>average speed</a>: "+avg+"km/h";
-				
-				
-				tripDist += dis;
-				if(timeDiff[i] > 2*24*3600 || i == data.length - 1) {
-					setTimeout(addInfo, tripIndex * 1200, geocoder, map, tripIndex, data[startIndex], tripDist);
-					tripIndex++;
-					tripDist = 0;
-				}
-				
-				var path = new google.maps.Polyline({
-					map: map,
-					path: data.slice(startIndex, i),
-					strokeColor: color,
-					strokeOpacity: 1,
-					strokeWeight: 4,
-					zIndex: 1,
-					icons: [{
-						icon: {path: google.maps.SymbolPath.FORWARD_CLOSED_ARROW},
-						offset: '20%',
-						repeat: '200px'
-					}],
-				});
-				bindInfoWindow(path, map, infoWindow, html);
-				startIndex = i;
-				up=0;
-				down=0;
-				timeMovement=0;
-			} else {
-				if(data[i].alt<250 || data[i].alt>260) {
-					if(data[i].alt>=data[i-1].alt)
-						up += data[i].alt - data[i-1].alt;
-					else
-						down += data[i-1].alt - data[i].alt;
-				} else {
-					if(data[i].hdop>200) {
-						speed[i] = 0;
-					}
-				}
-				if(speed[i]>60) {
-					console.log(speed[i].toFixed(2) + " km/h is too fast at " + data[i].format);
-				} else if(speed[i] > 2) {
-					timeMovement += timeDiff[i];
-				}
-			}
-		}
-			
-	
-	}
-	function bindInfoWindow(path, map, infoWindow, html) {
-		google.maps.event.addListener(path, 'click', function(e) {
-			infoWindow.setContent(html);
-			console.log(e);
-			infoWindow.setPosition(e.latLng);
-			infoWindow.open(map);				
-		});
-		google.maps.event.addListener(path, 'mouseover', function() {
-			path.setOptions({
-				zIndex: 2,
-				strokeWeight: 6
-			});
-		});
-		google.maps.event.addListener(path, 'mouseout', function() {
-			setTimeout(function() {
-				path.setOptions({
-					zIndex: 1,
-					strokeWeight: 4
-				});
-			}, 1000);
-		});
-	}
-	function addInfo(geocoder, map, id, data, dist) {
-		geocoder.geocode({'location': data}, function(results, status) {
-			if (status === 'OK') {
-				if (results[3]) {
-
-					$('#info').append("<div class='info' id='info_" + id + "'>" + 
-						data.format.substring(3, 10) + "<br>" +
-						results[3].formatted_address + "<br><b>" + 
-						(dist/1000).toFixed(1) + " km</b></div>");
-						
-					$('#info_'+id).click(function() {
-						map.panTo(data);
-						map.setZoom(12);
-					});
-				} else {
-					console.log('No results found');
-				}
-			} else {
-				console.log('Geocoder failed due to: ' + status);
-			}
-		});
-	}
-	function getRandomColor(i) {
-		/*var letters = '3456789ABCDEF'.split('');
-		var color = '#';
-		for (var i = 0; i < 6; i++ ) {
-			color += letters[Math.floor(Math.random() * 13)];
-		}
-		return color;*/
-		return "hsl(" + ((i*57) % 256) + ", 80%, 50%)";
-	}
-	function distance (lat1, lon1, lat2, lon2) {
-	 
-		// Convert degrees to radians
-		lat1 = lat1 * Math.PI / 180.0;
-		lon1 = lon1 * Math.PI / 180.0;
-	 
-		lat2 = lat2 * Math.PI / 180.0;
-		lon2 = lon2 * Math.PI / 180.0;
-	 
-		// radius of earth in metres
-		var r = 6378100;
-	 
-		// P
-		var rho1 = r * Math.cos(lat1);
-		var z1 = r * Math.sin(lat1);
-		var x1 = rho1 * Math.cos(lon1);
-		var y1 = rho1 * Math.sin(lon1);
-	 
-		// Q
-		var rho2 = r * Math.cos(lat2);
-		var z2 = r * Math.sin(lat2);
-		var x2 = rho2 * Math.cos(lon2);
-		var y2 = rho2 * Math.sin(lon2);
-	 
-		// Dot product
-		var dot = (x1 * x2 + y1 * y2 + z1 * z2);
-		var cos_theta = dot / (r * r);
-	 
-		var theta = Math.acos(cos_theta);
-	 
-		// Distance in Metres
-		return r * theta;
-	}
-	
-	function timeFormat (sec) {
-		return new Date(null,null,null,null,null,sec).toTimeString().match(/\d{2}:\d{2}:\d{2}/)[0];
-	}
-    //]]>
-
-  </script>
-  </head>
-
-  <body onload="load()" style="margin: 0; padding: 0;">
-    <div id="map" style="width: 800px; height: 800px"></div>
-		<div id="info" style="position:absolute; bottom:0; left:0;width:100%;overflow-x:auto;white-space: nowrap">
-			<div class="info">
-			  <form method="post" enctype="multipart/form-data" action='gps_insert.php'>
-          <input type="file" name="my_file[]" multiple><br>
-          <input type="submit" value="Upload">
-        </form>
-			</div>
-		</div>
-  </body>
-
-</html>

+ 0 - 173
gps_insert.php

@@ -1,173 +0,0 @@
-<?php
-ini_set("display_errors", "1");
-error_reporting(E_ALL);
-set_time_limit(300);
-
-require("connection.php");
-require("nmea_parser.php");
-
-	// Opens a connection to a MySQL server
-	$db = new PDO("mysql:host=$dbhost;dbname=$db;charset=utf8mb4", $dbuser, $dbpass);
-	$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
-	$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
-
-$data = Array();
-
-//print_r($_FILES);
-if(isset($_FILES['my_file'])){
-	echo "<table border='1px'>";
-	for($i=0;$i<count($_FILES['my_file']['name']);$i++){
-		$ext = strtolower(pathinfo($_FILES['my_file']['name'][$i], PATHINFO_EXTENSION));
-		if($ext == "txt") {
-			$fp = fopen($_FILES['my_file']["tmp_name"][$i], "r");
-			$fileContents=explode("\n", fread($fp, $_FILES['my_file']["size"][$i]));
-			fclose($fp);
-			echo "<tr><td>" . $_FILES['my_file']['name'][$i] . "</td>";
-			echo "<td>" . count($fileContents) . "</td>";
-			
-			$updated = 0;
-			
-			foreach($fileContents as $row) {
-				$row=explode(",", $row);
-				if(count($row)!=8) continue;
-
-				try {
-					//connect as appropriate as above
-					$stmt = $db->prepare("REPLACE INTO markers (timestamp,lat,lng,alt,hdop,speed,voltage,rssi) VALUES (?,?,?,?,?,?,?,?)");
-					$stmt->execute(array($row[1], $row[2], $row[3], $row[4], $row[5], $row[6], $row[7], $row[8]));
-					$updated += $stmt->rowCount();
-						
-				} catch(PDOException $ex) {
-						echo "An Error occured!"; //user friendly message
-						//some_logging_function($ex->getMessage());
-				}
-				
-			}
-			echo "<td>" . $updated . " rows updated</td>";
-			
-		} elseif($ext == "nmea") {
-			$fp = fopen($_FILES['my_file']["tmp_name"][$i], "r");
-			$fileContents=explode("\n", fread($fp, $_FILES['my_file']["size"][$i]));
-			fclose($fp);
-			echo "<tr><td>" . $_FILES['my_file']['name'][$i] . "</td>";
-			echo "<td>" . count($fileContents) . "</td>";
-			
-			$nmea = new NmeaParser();
-			foreach($fileContents as $row) {
-				$nmea->ParseLine($row);
-			}
-			$data = RamerDouglasPeucker2d(array_values($nmea->DumpNmea()), 0.00001); //.0001 = 7m
-			echo "<td>" . count($data) . "</td>";
-			
-			$oldLat = $oldLong = 0;
-			$rows = 0;
-			$updated = 0;
-			
-			foreach($data as $row) {
-				if(distance($oldLat, $oldLong, $row["lat"], $row["long"]) < 0.005) continue; 
-				$oldLat = $row["lat"];
-				$oldLong = $row["long"];
-				
-				if($row["speed"] == 0) {
-					$row["speed"] = null;
-				}
-
-				$rows++;
-				try {
-					$stmt = $db->prepare("REPLACE INTO markers (timestamp,lat,lng,alt,hdop,speed) VALUES (?,?,?,?,?,?)");
-					$stmt->execute(array(date('Y-m-d H:i:s', $row['Unix']), $row["lat"], $row["long"], $row["alt"], intval($row["hdp"]), $row["speed"] * 100));
-
-					$updated += $stmt->rowCount(); 
-				} catch(PDOException $ex) {
-						echo "An Error occured!"; //user friendly message
-						error_log($ex->getMessage());
-				}
-
-			}
-			echo "<td>" . $rows . "</td>";
-			echo "<td>" . $updated . " rows updated</td>";
-			
-		}
-	}
-	echo '</table><br><a href="gps_filter.php">delete private</a>';
-}
-function perpendicularDistance2d($ptX, $ptY, $l1x, $l1y, $l2x, $l2y) {
-		$result = 0;
-		if ($l2x == $l1x)
-		{
-				//vertical lines - treat this case specially to avoid dividing
-				//by zero
-				$result = abs($ptX - $l2x);
-		}
-		else
-		{
-				$slope = (($l2y-$l1y) / ($l2x-$l1x));
-				$passThroughY = (0-$l1x)*$slope + $l1y;
-				$result = (abs(($slope * $ptX) - $ptY + $passThroughY)) /
-									(sqrt($slope*$slope + 1));
-		}
-		return $result;
-}
-
-function RamerDouglasPeucker2d($pointList, $epsilon) {
-		if ($epsilon <= 0)
-		{
-				throw new InvalidParameterException('Non-positive epsilon.');
-		}
-		if (count($pointList) < 2)
-		{
-				return $pointList;
-		}
-		// Find the point with the maximum distance
-		$dmax = 0;
-		$index = 0;
-		$totalPoints = count($pointList);
-		for ($i = 1; $i < ($totalPoints - 1); $i++)
-		{
-				$d = perpendicularDistance2d(
-										$pointList[$i]["lat"], $pointList[$i]["long"],
-										$pointList[0]["lat"], $pointList[0]["long"],
-										$pointList[$totalPoints-1]["lat"],
-										$pointList[$totalPoints-1]["long"]);
-				if ($d > $dmax)
-				{
-						$index = $i;
-						$dmax = $d;
-				}
-		}
-		$resultList = array();
-		// If max distance is greater than epsilon, recursively simplify
-		if ($dmax >= $epsilon)
-		{
-				// Recursive call on each 'half' of the polyline
-				$recResults1 = RamerDouglasPeucker2d(
-									 array_slice($pointList, 0, $index + 1),
-														$epsilon);
-				$recResults2 = RamerDouglasPeucker2d(
-									 array_slice($pointList, $index, $totalPoints - $index),
-														$epsilon);
-				// Build the result list
-				$resultList = array_merge(array_slice($recResults1, 0,
-																							count($recResults1) - 1),
-																	array_slice($recResults2, 0,
-																							count($recResults2)));
-		}
-		else
-		{
-				$resultList = array($pointList[0], $pointList[$totalPoints-1]);
-		}
-		// Return the result
-		return $resultList;
-}
-
-function distance($lat1, $lon1, $lat2, $lon2) {
-
-  $theta = $lon1 - $lon2;
-  $dist = sin(deg2rad($lat1)) * sin(deg2rad($lat2)) +  cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * cos(deg2rad($theta));
-  $dist = acos($dist);
-  $dist = rad2deg($dist);
-  $miles = $dist * 60 * 1.1515;
-
-  return ($miles * 1.609344); //km
-}
-?>

+ 0 - 139
gps_logger_to_serial_csv.ino

@@ -1,139 +0,0 @@
-#include <SoftwareSerial.h>
-#include <TinyGPS.h>
-
-TinyGPS gps;
-SoftwareSerial ss(3, 2);
-unsigned long pattern = 0x00000000; //0000 speed, 0000 error
-
-static void smartdelay(unsigned long ms);
-static void print_float(float val, float invalid, int len, int prec);
-static void print_int(unsigned long val, unsigned long invalid, int len);
-static void print_date(TinyGPS &gps);
-static void print_str(const char *str, int len);
-long readVcc();
-
-void setup()
-{
-  Serial.begin(115200);
-  pinMode(13, OUTPUT);
-  ss.begin(9600);
-}
-
-  float flat, flon;
-  unsigned long age, date, time, chars = 0, chars2 = 0;
-  unsigned short sentences = 0, sentences2 = 0, failed = 0;
-
-void loop()
-{
-  gps.stats(&chars, &sentences, &failed);
-  if(gps.satellites() != TinyGPS::GPS_INVALID_SATELLITES && sentences != sentences2) {
-    gps.f_get_position(&flat, &flon, &age);
-    Serial.print(",");
-    print_date(gps);
-    Serial.print(",");
-    Serial.print(flat,6);
-    Serial.print(",");
-    Serial.print(flon,6);
-    Serial.print(",");
-    Serial.print(gps.f_altitude(),1);
-    Serial.print(",");
-    Serial.println(gps.hdop());
-
-  } 
-
-  
-
-  if(chars == chars2) pattern = 0xffff;
-  else if(sentences == sentences2) pattern = chars % 2;
-  else if(readVcc()<4000) pattern = 0;
-  else pattern = (gps.speed() << 16) + gps.satellites()-4;
-  
-  chars2 = chars;
-  sentences2 = sentences;
-  
-  smartdelay(1000);
-}
-long readVcc() { 
-  long result; // Read 1.1V reference against AVcc 
-  ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
-  delay(2); // Wait for Vref to settle
-  ADCSRA |= _BV(ADSC); // Convert
-  while (bit_is_set(ADCSRA,ADSC));
-  result = ADCL;
-  result |= ADCH<<8;
-  result = 1126400L / result; // Back-calculate AVcc in mV
-  return result;
-}
-static void smartdelay(unsigned long ms)
-{
-  unsigned long start = millis();
-  do 
-  {
-    digitalWrite(13, (pattern >> ((millis() % 1000) * 32 / 1000)) & 0x1 );
-    while (ss.available())
-      gps.encode(ss.read());
-  } while (millis() - start < ms);
-}
-
-static void print_float(float val, float invalid, int len, int prec)
-{
-  if (val == invalid)
-  {
-    while (len-- > 1)
-      Serial.print('*');
-    Serial.print(' ');
-  }
-  else
-  {
-    Serial.print(val, prec);
-    int vi = abs((int)val);
-    int flen = prec + (val < 0.0 ? 2 : 1); // . and -
-    flen += vi >= 1000 ? 4 : vi >= 100 ? 3 : vi >= 10 ? 2 : 1;
-    for (int i=flen; i<len; ++i)
-      Serial.print(' ');
-  }
-  smartdelay(0);
-}
-
-static void print_int(unsigned long val, unsigned long invalid, int len)
-{
-  char sz[32];
-  if (val == invalid)
-    strcpy(sz, "*******");
-  else
-    sprintf(sz, "%ld", val);
-  sz[len] = 0;
-  for (int i=strlen(sz); i<len; ++i)
-    sz[i] = ' ';
-  if (len > 0) 
-    sz[len-1] = ' ';
-  Serial.print(sz);
-  smartdelay(0);
-}
-
-static void print_date(TinyGPS &gps)
-{
-  int year;
-  byte month, day, hour, minute, second, hundredths;
-  unsigned long age;
-  gps.crack_datetime(&year, &month, &day, &hour, &minute, &second, &hundredths, &age);
-  if (age == TinyGPS::GPS_INVALID_AGE)
-    Serial.print("********** ******** ");
-  else
-  {
-    char sz[32];
-    sprintf(sz, "%02d-%02d-%02d %02d:%02d:%02d",
-        year, month, day, hour, minute, second);
-    Serial.print(sz);
-  }
-  //print_int(age, TinyGPS::GPS_INVALID_AGE, 5);
-  smartdelay(0);
-}
-
-static void print_str(const char *str, int len)
-{
-  int slen = strlen(str);
-  for (int i=0; i<len; ++i)
-    Serial.print(i<slen ? str[i] : ' ');
-  smartdelay(0);
-}

+ 0 - 60
index.php

@@ -1,60 +0,0 @@
-<!DOCTYPE html >
-  <head>
-		<meta name="viewport" content="width=device-width,initial-scale=1.0">
-    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
-    <title>GPS Logging</title>
-		<link href="/homepage/style.css" rel="stylesheet" type="text/css">
-		<link href="stylesheet.css" rel="stylesheet" type="text/css">
-		<link href="../libs/cesium-1.60/Widgets/widgets.css" rel="stylesheet" type="text/css">
-	</head>
-	
-	<body style="margin: 0; padding: 0;">
-		<div class="wrapper">
-			<header class="main-head">Homepage</header>
-			<nav class="main-nav">
-				<?php include "../links.php"; ?>
-			</nav>
-			<div class="content">
-				<div id="map" class="fullSize"></div>
-			</div>
-
-			<div class="status"></div>
-			<div class="sidebar">
-			</div>
-
-		</div>
-    
-		<div class="popup shadow" id="shadow"  onclick="hide()"></div>
-		<div class="popup frame" id="frame">
-			<div class="demo-container">
-				<div id="placeholder" class="demo-placeholder"></div>
-			</div>
-
-			<div class="demo-container" style="height:150px;">
-				<div id="overview" class="demo-placeholder"></div>
-			</div>
-			<p></p>
-			<p>Zoom to: 
-				<button id="whole">All</button>
-				<button id="track">Track</button>
-			</p>
-			<p>Move: 
-				<button id="left">Left</button>
-				<button id="right">Right</button>
-			</p> 
-			<ul id="tracks">
-			</ul>
-		</div>
-		<script language="javascript" type="text/javascript" src="../flot/jquery.js"></script>
-    <script src="../libs/cesium-1.60/Cesium.js" type="text/javascript"></script>
-    <script src="tracks.js" type="text/javascript"></script>
-		<script src="main.js" type="text/javascript"></script>
-		<!--[if lte IE 8]><script language="javascript" type="text/javascript" src="../flot/excanvas.min.js"></script><![endif]-->
-		<script language="javascript" type="text/javascript" src="../flot/jquery.min.js"></script>
-		<script language="javascript" type="text/javascript" src="../flot/jquery.flot.min.js"></script>
-		<script language="javascript" type="text/javascript" src="../flot/jquery.flot.time.min.js"></script>
-		<script language="javascript" type="text/javascript" src="../flot/jquery.flot.selection.min.js"></script>
-		<script language="javascript" type="text/javascript" src="../flot/jquery.flot.navigate.min.js"></script>
-  </body>
-	
-</html>

+ 45 - 0
migrations/0001_initial.py

@@ -0,0 +1,45 @@
+# Generated by Django 3.2.13 on 2022-08-12 14:26
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    initial = True
+
+    dependencies = [
+    ]
+
+    operations = [
+        migrations.CreateModel(
+            name='CensoredLocation',
+            fields=[
+                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+                ('lat', models.FloatField()),
+                ('lng', models.FloatField()),
+                ('name', models.CharField(max_length=255)),
+            ],
+        ),
+        migrations.CreateModel(
+            name='Marker',
+            fields=[
+                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+                ('timestamp', models.DateTimeField(unique=True)),
+                ('lat', models.FloatField()),
+                ('lng', models.FloatField()),
+                ('alt', models.FloatField()),
+                ('hdop', models.IntegerField()),
+                ('speed', models.IntegerField(blank=True, null=True)),
+            ],
+        ),
+        migrations.CreateModel(
+            name='Trip',
+            fields=[
+                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+                ('startTime', models.DateTimeField()),
+                ('endTime', models.DateTimeField()),
+                ('location', models.CharField(max_length=255)),
+                ('description', models.TextField(blank=True, null=True)),
+            ],
+        ),
+    ]

+ 0 - 0
migrations/__init__.py


+ 20 - 0
models.py

@@ -0,0 +1,20 @@
+from django.db import models
+
+class Marker(models.Model):
+  timestamp = models.DateTimeField(unique=True)
+  lat = models.FloatField()
+  lng = models.FloatField()
+  alt = models.FloatField()
+  hdop = models.IntegerField()
+  speed = models.IntegerField(null=True, blank=True)
+
+class Trip(models.Model):
+  startTime = models.DateTimeField()
+  endTime = models.DateTimeField()
+  location = models.CharField(max_length=255)
+  description = models.TextField(null=True, blank=True)
+
+class CensoredLocation(models.Model):
+  lat = models.FloatField()
+  lng = models.FloatField()
+  name = models.CharField(max_length=255)

+ 0 - 391
nmea_parser.php

@@ -1,391 +0,0 @@
-<?php
-//////////////////////////////////////////////////////////////////////////////////////////////////////////////
-//class.nmea.parser.php
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////
-//	NmeaParser Class
-//	Version: 1.0 
-//	Author: Terry Griffin
-//	Based on Code written by: David Boardman
-//	URL: http://cs.mwsu.edu/~griffin
-//	Licensed: GNU General Public License (GNU GPL)
-//
-//	Do what you want with the code. 
-//  Filtering not implemented yet....
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////
-class NmeaParser{
-	private $Nmea;  		//Nmea Array of data 
-	private $TimeStamp;		//Unix time stamp
-	private $maxHDOP;		//max horizontal dilution of precision
-	private $maxVDOP;		//max horizontal dilution of precision
-	private $CurrentUTC;	//Current time stamp to coordinate sentences	
-	
-	function __construct(){
-		$this->Nmea 	= array();
-		$this->TimeStamp= 0;
-		$this->maxHDOP	= 0.0;
-		$this->maxVDOP	= 0.0;
-		$this->CurrentUTC = 0;
-		$this->CurrentTime=0;
-	}
-	
-	///////////////////////////////////////////////////////////////////////////////////////////////////////////
-	//SetMinSatellites - Set the minimum satellite parameter to remove / ignore sentences that don't have
-	//enough satellites for a decent fix.	
-	//
-	//@param - 		int 	$minSats - minimum satellites
-	//@returns - 	void
-	///////////////////////////////////////////////////////////////////////////////////////////////////////////
-	public function SetMinSatellites($minSats=4){
-		$this->minSats = $minSats;
-	}
-	
-	//Dilution of precision:
-	//1		Ideal		This is the highest possible confidence level to be used for applications demanding the highest possible precision at all times.
-	//1-2	Excellent	At this confidence level, positional measurements are considered accurate enough to meet all but the most sensitive applications.
-	//2-5	Good		Represents a level that marks the minimum appropriate for making business decisions. Positional measurements could be used to make reliable in-route navigation suggestions to the user.
-	//5-10	Moderate	Positional measurements could be used for calculations, but the fix quality could still be improved. A more open view of the sky is recommended.
-	//10-20	Fair		Represents a low confidence level. Positional measurements should be discarded or used only to indicate a very rough estimate of the current location.
-	//>20	Poor		At this level, measurements are inaccurate by as much as 300 meters with a 6 meter accurate device (50 DOP × 6 meters) and should be discarded.
-	
-	
-	///////////////////////////////////////////////////////////////////////////////////////////////////////////
-	//SetMaxHdop - 
-	//Set the maximum (smaller value = better) horizontal dilution of precision parameter to 
-	//remove / ignore sentences that don't have enough satellites in the correct location in the sky for a 
-	//decent fix.	
-	//
-	//@param - 		int 	$maxHDOP - Hdop value
-	//@returns - 	void
-	///////////////////////////////////////////////////////////////////////////////////////////////////////////
-	public function SetMaxHdop($maxHDOP=10){
-		$this->maxHDOP = $maxHDOP;
-	}	
-	
-	///////////////////////////////////////////////////////////////////////////////////////////////////////////
-	//SetMaxVdop - 
-	//Set the maximum (smaller value = better) vertical dilution of precision parameter to 
-	//remove / ignore sentences that don't have enough satellites in the correct location in the sky for a 
-	//decent fix.	
-	//
-	//@param - 		int 	$maxVDOP - Hdop value
-	//@returns - 	void
-	///////////////////////////////////////////////////////////////////////////////////////////////////////////
-	public function SetMaxVdop($maxVDOP=10){
-		$this->maxVDOP = $maxVDOP;
-	}	
-	///////////////////////////////////////////////////////////////////////////////////////////////////////////
-	//NMEAtoUnixTime - Convert Date and Time to Linux Timestamp
-	//
-	//@param - 		string 	$time - current utc(hhmmss)
-	//@param -      int $date - current date (mmddyy)
-	//@returns - 	int - timestamp
-	///////////////////////////////////////////////////////////////////////////////////////////////////////////
-	private function NMEAtoUnixTime($utc,$date){
-		$h = substr($utc,0,2);
-		$i = substr($utc,2,2);
-		$s = substr($utc,4,2);
-		$d = substr($date,0,2);
-		$m = substr($date,2,2);
-		$y = substr($date,4,2);		
-		//list($y,$m,$d) = explode('-',$date);
-		return mktime($h,$i,$s,$m,$d,$y);
-	}
-	
-	///////////////////////////////////////////////////////////////////////////////////////////////////////////
-	//ParseLine - Parse the current line 
-	//
-	//@param - 		string 	$line - current nmea line
-	//@returns - 	void
-	///////////////////////////////////////////////////////////////////////////////////////////////////////////
-	public function ParseLine($line){
-		$this->NmeaType = $this->SetNmeaType($line);
-		switch($this->type){
-			case "GPGGA": $this->GPGGA($line);break;
-			case "GPGLL": $this->GPGLL($line);break;
-			case "GPGSA": $this->GPGSA($line);break;
-			case "GPGSV": $this->GPGSV($line);break;
-			case "GPRMC": $this->GPRMC($line);break;
-			case "GPVTG": $this->GPVTG($line);break;
-			default: return;
-		}
-	}
-	///////////////////////////////////////////////////////////////////////////////////////////////////////////
-	//DumpNmea - Returns current Nmea data 
-	//
-	//@param - 		void
-	//@returns - 	array - Nmea data
-	///////////////////////////////////////////////////////////////////////////////////////////////////////////	
-	public function DumpNmea(){
-		return $this->Nmea;
-	}
-	
-	
-	function GoodEnough(){
-		return isset($this->Nmea[$this->CurrentUTC]['date']) && isset($this->Nmea[$this->CurrentUTC]['utc']) && isset($this->Nmea[$this->CurrentUTC]['lat']) && isset($this->Nmea[$this->CurrentUTC]['long']);
-	
-	}
-	
-	///////////////////////////////////////////////////////////////////////////////////////////////////////////
-	//NmeaType - GPGGA,GPGLL,GPGSA,GPGSV,GPRMC,GPVTG
-	//
-	//@param - 		int 	$NmeaType - what type of nmea sentence is it currently
-	//@returns - 	void
-	///////////////////////////////////////////////////////////////////////////////////////////////////////////
-	private function SetNmeaType($line){
-		$this->type = trim(strtoupper(substr($line,1,5)));
-		return $this->type;
-	}
-	//////////////////////////////////////////////////////////////////////////////////////////////////////
-	//GGA - essential fix data which provide 3D location and accuracy data.
-	//
-	// $GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47
-	//
-	//Where:
-	//     GGA          Global Positioning System Fix Data
-	//     123519       Fix taken at 12:35:19 UTC
-	//     4807.038,N   Latitude 48 deg 07.038' N
-	//     01131.000,E  Longitude 11 deg 31.000' E
-	//     1            Fix quality: 	0 = invalid
-	//                              	1 = GPS fix (SPS)
-	//                               	2 = DGPS fix
-	//                               	3 = PPS fix
-	//			       					4 = Real Time Kinematic
-	//			       					5 = Float RTK
-	//                               	6 = estimated (dead reckoning) (2.3 feature)
-	//			       					7 = Manual input mode
-	//			       					8 = Simulation mode
-	//     08           Number of satellites being tracked
-	//     0.9          Horizontal dilution of position
-	//     545.4,M      Altitude, Meters, above mean sea level
-	//     46.9,M       Height of geoid (mean sea level) above WGS84
-	//                      ellipsoid
-	//     (empty field) time in seconds since last DGPS update
-	//     (empty field) DGPS station ID number
-	//     *47          the checksum data, always begins with *	
-	//////////////////////////////////////////////////////////////////////////////////////////////////////	
-	private function GPGGA($geostr){
-		$split=explode(",",$geostr);
-		$this->CurrentUTC = $this->fixUTC($split[1]);			
-		$this->Nmea[$this->CurrentUTC]['type']['GPGGA']=true;
-		$this->Nmea[$this->CurrentUTC]['utc']=$this->fixUTC($split[1]);
-		$this->Nmea[$this->CurrentUTC]['lat']=$this->degree2decimal($split[2],$split[3]);
-		$this->Nmea[$this->CurrentUTC]['ns']=$split[3];
-		$this->Nmea[$this->CurrentUTC]['long']=$this->degree2decimal($split[4],$split[5]);
-		$this->Nmea[$this->CurrentUTC]['ew']=$split[5];
-		$this->Nmea[$this->CurrentUTC]['gpsqual']=$split[6];
-		$this->Nmea[$this->CurrentUTC]['numsat']=$split[7];
-		$this->Nmea[$this->CurrentUTC]['hdp']=$split[8];
-		$this->Nmea[$this->CurrentUTC]['alt']=$split[9];
-		$this->Nmea[$this->CurrentUTC]['un_alt']=$split[10];
-		$this->Nmea[$this->CurrentUTC]['geoidal']=$split[11];
-		$this->Nmea[$this->CurrentUTC]['un_geoidal']=$split[12];
-		$this->Nmea[$this->CurrentUTC]['dgps']=$split[13];
-		$this->Nmea[$this->CurrentUTC]['diffstat']=trim($split[14]);
-	}
-	//////////////////////////////////////////////////////////////////////////////////////////////////////
-	//  $GPGLL,4916.45,N,12311.12,W,225444,A,*1D
-	//
-	//Where:
-	//     GLL          Geographic position, Latitude and Longitude
-	//     4916.46,N    Latitude 49 deg. 16.45 min. North
-	//     12311.12,W   Longitude 123 deg. 11.12 min. West
-	//     225444       Fix taken at 22:54:44 UTC
-	//     A            Data Active or V (void)
-	//     *iD          checksum data
-	//////////////////////////////////////////////////////////////////////////////////////////////////////
-	private function GPGLL($geostr){
-		$split=explode(",",$geostr);
-		$this->Nmea[$this->CurrentUTC]['type']['GPGLL']=true;
-		$this->CurrentUTC = $this->fixUTC($split[3]);
-		$this->Nmea[$this->CurrentUTC]['utc']=$this->fixUTC($split[3]);
-		$this->Nmea[$this->CurrentUTC]['status']=$this->dataStatus($split[4]);
-	}
-	//////////////////////////////////////////////////////////////////////////////////////////////////////
-	//  $GPGSA,A,3,04,05,,09,12,,,24,,,,,2.5,1.3,2.1*39
-	//
-	//Where:
-	//     GSA      Satellite status
-	//     A        Auto selection of 2D or 3D fix (M = manual) 
-	//     3        3D fix - values include: 1 = no fix
-	//                                       2 = 2D fix
-	//                                       3 = 3D fix
-	//     04,05... PRNs of satellites used for fix (space for 12) 
-	//     2.5      PDOP (dilution of precision) 
-	//     1.3      Horizontal dilution of precision (HDOP) 
-	//     2.1      Vertical dilution of precision (VDOP)
-	//     *39      the checksum data, always begins with *
-	//////////////////////////////////////////////////////////////////////////////////////////////////////
-	private function GPGSA($geostr){ 
-		$split=explode(",",$geostr);
-		$this->Nmea[$this->CurrentUTC]['type']['GPGSA']=true;
-		$this->Nmea[$this->CurrentUTC]['selectmode']=$split[1];
-		$this->Nmea[$this->CurrentUTC]['mode']=$split[2];
-		$this->Nmea[$this->CurrentUTC]['sat1']=$split[3];
-		$this->Nmea[$this->CurrentUTC]['sat2']=$split[4];
-		$this->Nmea[$this->CurrentUTC]['sat3']=$split[5];
-		$this->Nmea[$this->CurrentUTC]['sat4']=$split[6];
-		$this->Nmea[$this->CurrentUTC]['sat5']=$split[7];
-		$this->Nmea[$this->CurrentUTC]['sat6']=$split[8];
-		$this->Nmea[$this->CurrentUTC]['sat7']=$split[9];
-		$this->Nmea[$this->CurrentUTC]['sat8']=$split[10];
-		$this->Nmea[$this->CurrentUTC]['sat9']=$split[11];
-		$this->Nmea[$this->CurrentUTC]['sat10']=$split[12];
-		$this->Nmea[$this->CurrentUTC]['sat11']=$split[13];
-		$this->Nmea[$this->CurrentUTC]['sat12']=$split[14];
-		$this->Nmea[$this->CurrentUTC]['pdop']=$split[15];
-		$this->Nmea[$this->CurrentUTC]['hdop']=$split[16];
-		$this->Nmea[$this->CurrentUTC]['vdop']=$split[17];
-	}
-	//////////////////////////////////////////////////////////////////////////////////////////////////////
-	//  $GPGSV,2,1,08,01,40,083,46,02,17,308,41,12,07,344,39,14,22,228,45*75
-	//
-	//Where:
-	//      GSV          Satellites in view
-	//      2            Number of sentences for full data
-	//      1            sentence 1 of 2
-	//      08           Number of satellites in view
-	//
-	//      01           Satellite PRN number
-	//      40           Elevation, degrees
-	//      083          Azimuth, degrees
-	//      46           SNR - higher is better
-	//           for up to 4 satellites per sentence
-	//      *75          the checksum data, always begins with *
-	//////////////////////////////////////////////////////////////////////////////////////////////////////
-	//*********needs fixing
-	private function GPGSV($geostr){
-		$split=explode(",",$geostr);
-		$this->Nmea[$this->CurrentUTC]['type']['GPGSV']=true;
-		$this->Nmea[$this->CurrentUTC]['satmessages']=$split[1];
-		$this->Nmea[$this->CurrentUTC]['messnum']=$split[2];
-		$this->Nmea[$this->CurrentUTC]['satview']=$split[3];
-		$this->Nmea[$this->CurrentUTC]['satnum']=$split[4];
-		$this->Nmea[$this->CurrentUTC]['elevdeg']=$split[5];
-		$this->Nmea[$this->CurrentUTC]['azimuthdeg']=$split[6];
-		$this->Nmea[$this->CurrentUTC]['snr']=$split[7];
-	}
-	//////////////////////////////////////////////////////////////////////////////////////////////////////
-	//$GPRMC,123519,A,4807.038,N,01131.000,E,022.4,084.4,230394,003.1,W*6A
-	//
-	//Where:
-	//     RMC          Recommended Minimum sentence C
-	//     123519       Fix taken at 12:35:19 UTC
-	//     A            Status A=active or V=Void.
-	//     4807.038,N   Latitude 48 deg 07.038' N
-	//     01131.000,E  Longitude 11 deg 31.000' E
-	//     022.4        Speed over the ground in knots
-	//     084.4        Track angle in degrees True
-	//     230394       Date - 23rd of March 1994
-	//     003.1,W      Magnetic Variation
-	//     *6A          The checksum data, always begins with *
-	//////////////////////////////////////////////////////////////////////////////////////////////////////
-	private function GPRMC($geostr){
-		$split=explode(",",$geostr);
-		$this->CurrentUTC = $this->fixUTC($split[1]);
-		$this->Nmea[$this->CurrentUTC]['utc']=$this->fixUTC($split[1]);
-		$this->Nmea[$this->CurrentUTC]['type']['GPRMC']=true;
-		$this->Nmea[$this->CurrentUTC]['statusrmc']=$split[2];
-		$this->Nmea[$this->CurrentUTC]['speed']=$split[7];
-		$this->Nmea[$this->CurrentUTC]['track']=$split[8];		
-		$this->Nmea[$this->CurrentUTC]['date']=$split[9];
-		$this->Nmea[$this->CurrentUTC]['magvar']=$split[10];
-		$this->Nmea[$this->CurrentUTC]['mag_ew']=trim($split[11]);
-		if($this->CurrentUTC && $split[9])
-			$this->Nmea[$this->CurrentUTC]['Unix'] = $this->NMEAtoUnixTime($this->CurrentUTC,$split[9]);
-	}
-	
-	//////////////////////////////////////////////////////////////////////////////////////////////////////	
-	//VTG - Velocity made good. The gps receiver may use the LC prefix instead of GP if it is emulating Loran output.
-	//
-	//  $GPVTG,054.7,T,034.4,M,005.5,N,010.2,K*48
-	//
-	//where:
-	//        VTG          Track made good and ground speed
-	//        054.7,T      True track made good (degrees)
-	//        034.4,M      Magnetic track made good
-	//        005.5,N      Ground speed, knots
-	//        010.2,K      Ground speed, Kilometers per hour
-	//        *48          Checksum
-	//////////////////////////////////////////////////////////////////////////////////////////////////////
-	private function GPVTG($geostr){
-		$split=explode(",",$geostr);
-		$this->Nmea[$this->CurrentUTC]['type']['GPVTG']=true;
-		$this->Nmea[$this->CurrentUTC]['trkdeg1']=$split[1];
-		$this->Nmea[$this->CurrentUTC]['t']=$split[2];
-		$this->Nmea[$this->CurrentUTC]['trkdeg2']=$split[3];
-		$this->Nmea[$this->CurrentUTC]['m']=$split[4];
-		$this->Nmea[$this->CurrentUTC]['spdknots']=$spdk=$split[5];
-		$this->Nmea[$this->CurrentUTC]['knots']=$split[6];
-		$this->Nmea[$this->CurrentUTC]['spdkmph']=$split[7];
-		$this->Nmea[$this->CurrentUTC]['kph']=$split[8];
-	}
-	
-	//////////////////////////////////////////////////////////////////////////////////////////////////////	
-	//degree2decimal- 
-	//Convert latitude and longitude in degrees minutes seconds format to decimal format.
-	//E.g. = 4807.038,N would be 48.12722
-	//Formula is as follows
-	//	Degrees=Degrees
-	//	.d = M.m/60
-	//	Decimal Degrees=Degrees+.d	
-	//////////////////////////////////////////////////////////////////////////////////////////////////////
-    private function degree2decimal($deg_coord,$direction,$precision=6){
-		$degree=(int)($deg_coord/100); //simple way
-		$minutes= $deg_coord-($degree*100);
-		$dotdegree=$minutes/60;
-		$decimal=$degree+$dotdegree;
-		//South latitudes and West longitudes need to return a negative result
-        if (($direction=="S") or ($direction=="W"))
-        {
-    		$decimal=$decimal*(-1);
-		}
-    	$decimal=number_format($decimal,$precision,'.',''); //truncate decimal to $precision places
-    	return $decimal;
-	}	
-	
-	//////////////////////////////////////////////////////////////////////////////////////////////////////	
-	//TimeChanged- 
-	//@param int $Time - time value
-	//@return bool  0,1 (If both time are not equal, then we are processing new nmea data.)
-	//			
-	//////////////////////////////////////////////////////////////////////////////////////////////////////
-	private function TimeChanged($Time){
-		return $this->CurrentTime==$Time;
-	}
-	
-	//////////////////////////////////////////////////////////////////////////////////////////////////////	
-	//GetNmeaData- 
-	//@param void
-	//@return array  - nmea data array
-	//			
-	//////////////////////////////////////////////////////////////////////////////////////////////////////
-	public function GetNmeaData(){
-		return $this->Nmea;
-	}	
-	
-	//////////////////////////////////////////////////////////////////////////////////////////////////////	
-	//fixUTCKey- 
-	//Replaces keys based on UTC with a linux time stamp.
-	//@param int $UTC - UTC time  (time only)
-	//@param int $Unix - linux timestamp (has date)
-	//////////////////////////////////////////////////////////////////////////////////////////////////////
-	private function fixUTCKey($UTC,$Unix){
-		//Not done
-		$arr[$newkey] = $arr[$oldkey];
-		unset($arr[$oldkey]);	
-	}
-	
-	//////////////////////////////////////////////////////////////////////////////////////////////////////	
-	//cleanUTC- 
-	//If UTC has a decimal in it, get rid of it.
-	//@param int $UTC - UTC time  (time only)
-	//@return int $UTCfixed - 
-	//////////////////////////////////////////////////////////////////////////////////////////////////////
-	private function fixUTC($UTC){
-		//list($Fixed,$Null) = explode('.',$UTC);
-		return $UTC; //$Fixed;
-	}	
-	
-	
-}
-?>

+ 0 - 48
table.sql

@@ -1,48 +0,0 @@
-
-SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
-START TRANSACTION;
-SET time_zone = "+00:00";
-
---
--- Datenbank: `arduino`
---
-
--- --------------------------------------------------------
-
---
--- Tabellenstruktur für Tabelle `markers`
---
-
-CREATE TABLE `markers` (
-  `id` int(11) NOT NULL,
-  `timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
-  `lat` float(10,6) NOT NULL,
-  `lng` float(10,6) NOT NULL,
-  `alt` float(5,1) NOT NULL,
-  `hdop` int(11) NOT NULL,
-  `speed` int(11) DEFAULT NULL,
-  `voltage` int(11) DEFAULT NULL,
-  `rssi` int(11) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-
---
--- Indizes der exportierten Tabellen
---
-
---
--- Indizes für die Tabelle `markers`
---
-ALTER TABLE `markers`
-  ADD PRIMARY KEY (`id`),
-  ADD UNIQUE KEY `timestamp` (`timestamp`);
-
---
--- AUTO_INCREMENT für exportierte Tabellen
---
-
---
--- AUTO_INCREMENT für Tabelle `markers`
---
-ALTER TABLE `markers`
-  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
-COMMIT;

+ 3 - 0
tests.py

@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.

+ 3 - 0
views.py

@@ -0,0 +1,3 @@
+from django.shortcuts import render
+
+# Create your views here.