I’m using the TNN mapper and I can’t see the data on TTN mapper. I’m getting the json payload below in the application so I know the data is being received by the app and parsed but not being received or processed by the TTN Mapper. From looking at the TTN Mapper website, it says I should have:
A JSON object containing the keys “latitude”, “longitude” and “altitude”. In addition the JSON object must contain one of the following keys “hdop”, “accuracy” or “sats”.
It looks like I’m not getting the hdop values, any ideas why?
Did you setup a decoder script in the ttn console for your application ?
It is in the “Payload formats” tab of the application console. It is that script which is responsible for decoding the payload from binary to json.
Here’s mine (a cut-and-paste from some example code which I can’t remember the source) :
function Decoder(bytes, port) {
// Decode an uplink message from a buffer
// (array) of bytes to an object of fields.
var decoded = {};
decoded.latitude = ((bytes[0]<<16)>>>0) + ((bytes[1]<<8)>>>0) + bytes[2];
decoded.latitude = (decoded.latitude / 16777215.0 * 180) - 90;
decoded.longitude = ((bytes[3]<<16)>>>0) + ((bytes[4]<<8)>>>0) + bytes[5];
decoded.longitude = (decoded.longitude / 16777215.0 * 360) - 180;
var altValue = ((bytes[6]<<8)>>>0) + bytes[7];
var sign = bytes[6] & (1 << 7);
if(sign)
{
decoded.altitude = 0xFFFF0000 | altValue;
}
else
{
decoded.altitude = altValue;
}
decoded.hdop = bytes[8] / 10.0;
return decoded;
}