You can use computed attributes to calculate a new location, if your device is still reporting some data.
As for distance, I believe we do support odometer value, but depends on what IO id your device is using.
Many thanks anton.
Do you have a computed attribute code to calculate lon & lat.
I am using this code but dose not work:
New Latitudevar normalizedCourse = lastCourse % 360; if (normalizedCourse < 0) { normalizedCourse += 360; } var course_radians = math:toRadians(normalizedCourse); var lastLatitude_radians = math:toRadians(lastLatitude); var R = 6371000; // Earth's radius in meters // Calculate the new latitude var newLatitude = lastLatitude + (distance / R) * (180 / 3.14159) * math:cos(course_radians);
NewLongitude// Normalize the course to the 0-360 range var normalizedCourse = lastCourse % 360; if (normalizedCourse < 0) { normalizedCourse += 360; // Handle negative values } var course_radians = math:toRadians(normalizedCourse); var lastLatitude_radians = math:toRadians(lastLatitude); var R = 6371000; // Earth's radius in meters // Calculate the new longitude var newLongitude = lastLongitude + (distance / (R * math:cos(lastLatitude_radians))) * (180 / 3.14159) * math:sin(course_radians);
You really don't have any line breaks there?
New Latitude
var normalizedCourse = lastCourse % 360;
if (normalizedCourse < 0) { normalizedCourse += 360; }
var course_radians = math:toRadians(normalizedCourse);
var lastLatitude_radians = math:toRadians(lastLatitude);
var R = 6371000; // Earth's radius in meters
var newLatitude = lastLatitude + (distance / R) * (180 / 3.14159) * math:cos(course_radians); // Calculate the new latitude
NewLongitude
// Normalize the course to the 0-360 range
var normalizedCourse = lastCourse % 360;
if (normalizedCourse < 0) { normalizedCourse += 360; // Handle negative values }
var course_radians = math:toRadians(normalizedCourse);
var lastLatitude_radians = math:toRadians(lastLatitude);
var R = 6371000; // Earth's radius in meters
var newLongitude = lastLongitude + (distance / (R * math:cos(lastLatitude_radians))) * (180 / 3.14159) * math:sin(course_radians); // Calculate the new longitude
We have a jamming in our area. So the vehicle remains in wrong location for long time.
Can I use computed attributes to calculate new lon & lat values based on course, (distance or time), speed, and last right lon & lat.
By the way, i noticed that the distance is calculated based on change in lon and lat not come from device, how can i get the distance from device (I am using teltonika )
Best Regards