Feature Request : Trip Details

jaimzj9 years ago

Dear Anton,

Just wanted to make a mention of a possible scenario that can be a value add feature.

When a device is constantly on the move, and stops each such trips if it can be logged. Which can help users get details of trips filtered out, or view averages/distance etc for that particular trip.

Whats your thought on this?

Anton Tananaev9 years ago

How would you detect stops?

jaimzj9 years ago

Time difference between previous position and current position being checked? (Maybe configurable value per device, if above certain value) then.. trip stop.

Anton Tananaev9 years ago

It's not going to work. GPS location can fluctuate even if device doesn't move. Especially if there are tall buildings around. The only option I can think of is using accelerometer if device has it.

jaimzj9 years ago

I agree GPS location does come with that problem, However accelerometer is neither available in all devices.

Another way could be, Ignition status as well, but I didn't suggest that as again ignition detection might be optionally available in most device.

And a possible formulae not dependent on sensors, so that it works for all devices, as per me the best I could think was, Time Difference and or Speed value and or a combination of distance travelled as well.

Anton Tananaev9 years ago

I plan to implement extended reporting eventually. We can discuss ways to detect stops then. I don't think I would have a chance to implement something before that.

charlymanja9 years ago

I have a php script that calculates distance between coordinates (latitude & longitude)with a form, maybe can use the simple method to calculate distance using lat&long params....

I hope it helps for future features and also I have a lot of "`feature requests"

<?php
/* This script calculates the distance between two points
 * with the latitud an longitude of those points
 * lat1 and lon1 = First position in cardinal point
 * lat2 and lon2 = Second position in cardinal point
 * unit = Select metric system .....
 *  K = kilometers
 *  M = Miles (default if argument not given)
 *  N = Nautical miles
 */

//include ("configuration-inc.php");

$lat1 = $_GET["lat1"];
$lon1 = $_GET["lon1"];
$lat2 = $_GET["lat2"];
$lon2 = $_GET["lon2"];
$unit = $_GET["unit"];
?>
<form name="calcDistance" action="distance.php" method="GET">
                Initial latitude<input id="lat1" type="text" name="lat1" value="20" size="10" /> 
                Initial longitud<input id="lon1" type="text" name="lon1" value="-98" size="10" />
                Final latitude<input id="lat2" type="text" name="lat2" value="21" size="10" />
                Final latitude<input id="lon2" type="text" name="lon2" value="-99" size="10" />
                <select id="unit" name="unit">
                    <option>K</option>
                    <option>M</option>
                    <option>N</option>
                </select>
                <input type="submit" value="Calc" name="calc" />
                <input type="reset" value="Reset" name="reset" />
            </form>

<?php
if (!is_null($lat1)) {

function distance($lat1, $lon1, $lat2, $lon2, $unit) {

  $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;
  $unit = strtoupper($unit);

  if ($unit == "K") {
    return ($miles * 1.609344);
  } else if ($unit == "N") {
      return ($miles * 0.8684);
    } else {
        return $miles;
      }
}
//print "$lat1, $lon1, $lat2, $lon2, $unit";
/*
 * URL to calc distance
 * http://192.168.1.64/RTTracking-Demo/distance.php?lat1=19.5657564&long1=-98.856697&lat2=19.5656303&long2=-98.856626&unit=k
 */

//echo distance(32.9697, -96.80322, 29.46786, -98.53506, "M") . " Miles<br>";
//echo distance( 19.5657564, -98.856697, 19.5656303, -98.856626, "K") . " Kilometers<br>";
echo distance( $lat1, $lon1, $lat2, $lon2, $unit) . " Kilometers (straight line)<br>";
//echo distance(32.9697, -96.80322, 29.46786, -98.53506, "N") . " Nautical Miles<br>";

/*
 * https://www.google.com.mx/maps/dir/19.5658056,-98.8564175/19.565678,-98.8571403/@19.565575,-98.8567702,20z?hl=en
 * Google iFrame
 * https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d6322.5853513439815!2d-98.85785067221758!3d19.565995570632634!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x85d1e83fc1ff1777%3A0x5c9a814293d92208!2sComonfort+15%2C+Ixayoc%2C+56050+Papalotla%2C+M%C3%A9x.!5e0!3m2!1sen!2smx!4v1449194648637
 */
print '<a href="';
print "https://www.google.com.mx/maps/dir/" . "$lat1,$lon1/$lat2,$lon2/@$lat1,$lon1" ." ,18z?hl=en";
print '" target="_blank">Route navigation map </a></br>';
print " </br>";
//print '<iframe src="https://www.google.com/maps/embed?pb=$lat1,$lon1/$lat2,$lon2,1z" width="800" height="700" frameborder="0" style="border:0" allowfullscreen></iframe>';

}
?>
Anton Tananaev9 years ago

Traccar already includes distance calculation feature.

charlymanja9 years ago

Thanks, but I've 3.2 version and canĀ“t see how to calculate distance....

Anton Tananaev9 years ago

It should be available in 3.2. Here is a config parameter to enable it:

<entry key='distance.enable'>true</entry>
charlymanja9 years ago

thx in advance, let me check it!

charlymanja9 years ago

Where can I find all params of "entry key" ??

charlymanja9 years ago