Rename 'angle' as 'bearing'

This commit is contained in:
Bartek Fabiszewski 2017-01-30 23:46:25 +01:00
parent 141be576f2
commit 0d396a34ec
3 changed files with 9 additions and 7 deletions

2
README
View File

@ -24,6 +24,8 @@ Features:
Todo
- install script
- custom icons
- admin page (users management)
- track editing
License
- GPL

View File

@ -29,8 +29,8 @@ function haversine_distance($lat1, $lon1, $lat2, $lon2) {
$lon2 = deg2rad($lon2);
$latD = $lat2 - $lat1;
$lonD = $lon2 - $lon1;
$angle = 2*asin(sqrt(pow(sin($latD/2),2)+cos($lat1)*cos($lat2)*pow(sin($lonD/2),2)));
return $angle * 6371000;
$bearing = 2*asin(sqrt(pow(sin($latD/2),2)+cos($lat1)*cos($lat2)*pow(sin($lonD/2),2)));
return $bearing * 6371000;
}
if ($userid) {
@ -54,7 +54,7 @@ if ($userid) {
$query->bind_param('i', $userid);
}
$query->execute();
$query->bind_result($positionid,$latitude,$longitude,$altitude,$speed,$angle,$dateoccured,$accuracy,$comments,$username,$trackname,$trackid);
$query->bind_result($positionid,$latitude,$longitude,$altitude,$speed,$bearing,$dateoccured,$accuracy,$comments,$username,$trackname,$trackid);
header("Content-type: text/xml");
$xml = new XMLWriter();
@ -70,7 +70,7 @@ if ($userid) {
$xml->writeElement("longitude", $longitude);
$xml->writeElement("altitude", ($altitude)?round($altitude):$altitude);
$xml->writeElement("speed", $speed);
$xml->writeElement("angle", $angle);
$xml->writeElement("bearing", $bearing);
$xml->writeElement("dateoccured", $dateoccured);
$xml->writeElement("accuracy", $accuracy);
$xml->writeElement("comments", $comments);

View File

@ -139,8 +139,8 @@ function parsePosition(p) {
if (altitude != null) { altitude = parseInt(altitude); }
var speed = getNode(p,'speed'); // may be null
if (speed != null) { speed = parseInt(speed); }
var angle = getNode(p,'angle'); // may be null
if (angle != null) { angle = parseInt(angle); }
var bearing = getNode(p,'bearing'); // may be null
if (bearing != null) { bearing = parseInt(bearing); }
var accuracy = getNode(p,'accuracy'); // may be null
if (accuracy != null) { accuracy = parseInt(accuracy); }
var comments = getNode(p,'comments'); // may be null
@ -155,7 +155,7 @@ function parsePosition(p) {
'longitude': longitude,
'altitude': altitude,
'speed': speed,
'angle': angle,
'bearing': bearing,
'accuracy': accuracy,
'comments': comments,
'username': username,