How to solve the NaN value in updated location field
My code is to get a new field of location from available column longitude, latitude, elevation. Built with no error.
// result: INFOTABLE dataShapeName : "MapData"
var result = Things["ThingName"].ServiceName(); // Change the ThingName and Service name herevar newField = new Object();
newField.name = "location";
newField.baseType = 'LOCATION';
result.AddField(newField);// location:LOCATION
var temp = new Object();var tableLength = result.rows.length;
for (var x = 0; x < tableLength; x++) {
var row = result.rows;
temp.latitude = row.latitude;//result.rows.latitude;
temp.longitude = row.longitude;//result.rows.longitude;
temp.elevation = 0;
temp.units = "WGS84";
row.location = temp;
}
But the output is like this. The location column is all NaN:NaN. Something is wrong?


