Help me Please.. About NaN
Retrieves data from the database
If the longitude value is 0, the previous GPS value is obtained.
If the longitude value is not 0 in the database, the distance is obtained


However, if the longitude value is 0, it is output as NaN


and GPSvalue was obtain when longitude value is 0
but distance is not obtain when longitude value is 0
why? i don't know... T^T
Help me.. Thanks...
and attach my code
var params = {
datetime: w /* DATETIME */,
cdma_number: me.cdma_number /* STRING */
}; // result: INFOTABLE dataShape: TruckDataFeildDataShape
var TruckData = Things["GetTruckDateFromPostgreDB"].GetTruckData(params);
var params = {
oldestFirst: true /* BOOLEAN */,
maxItems: undefined /* NUMBER */,
endDate: undefined /* DATETIME */,
query: undefined /* QUERY */,
startDate: w /* DATETIME */
};
// result: INFOTABLE dataShape: "undefined"
var AAA = me.QueryPropertyHistory(params);
var pre = AAA.getRow(0);
var GPS = new Object();
var params = {
datetime: TruckData.kst_datetime /* DATETIME */,
cdma_number: "01088948133" /* STRING */
};
// result: INFOTABLE dataShape: TruckDataFeildDataShape
var preEntry = Things["GetTruckDateFromPostgreDB"].CompareTruckData(params);
var PGPS = new Object();
if(preEntry.latitude ==0){
PGPS=pre.GPS;
}
else{
PGPS.latitude = parseInt(preEntry.latitude/100)+(preEntry.latitude - parseInt(preEntry.latitude/100)*100)/60;
PGPS.longitude= parseInt(preEntry.longitude/100)+(preEntry.longitude - parseInt(preEntry.longitude/100)*100)/60;
PGPS.elevation = 0;
PGPS.units = "WGS84";
}
if(TruckData.latitude ==0){
GPS = PGPS}
else{
GPS.latitude = parseInt(TruckData.latitude/100)+(TruckData.latitude - parseInt(TruckData.latitude/100)*100)/60;
GPS.longitude= parseInt(TruckData.longitude/100)+(TruckData.longitude - parseInt(TruckData.longitude/100)*100)/60;
GPS.elevation = 0;
GPS.units = "WGS84";
}
// distanceBetween(loc1:LOCATION,loc2:LOCATION,units:STRING):NUMBER
// distanceBetween(loc1:LOCATION,loc2:LOCATION,units:STRING):NUMBER
var difference = distanceBetween(GPS, PGPS, "");
