How to pull a device's current position coordinates through the SDK?

Related Questions

  • How To Get Device Speed At Certain Position Through SDK?
  • How To Get Vehicle Degree Direction Through API?
  • How to get a shapefile extract of distances travelled through a MyGeotab?

Applies To

  • MyGeotab
  • SDK

Answer

api.call("Get", {
    "typeName": "LogRecord",
    "search":{
        "DeviceSearch":{
            "id":"b15"
    },
    "fromDate": "2019-05-06T00:00:00.000Z",
    "toDate": "2019-05-07T23:00:00.000Z"
 }
}, function(result) {
    console.log("Done: ", result);
}, function(e) {
    console.error("Failed:", e);
});
  • Modify the Device Id, fromDate and toDate accordingly

Additional Notes

For getting the Degree direction of a device position, please follow the following link as it has useful information to convert a coordinate based position to degree through Java Script and Excel formulas.