TheThingsNetwork GPS


#1

I’m trying to implement an GPS from TTN and “Map” is not catching the Lat-Long value.
I’m using this decoder from TTN:

function Decoder(b, port) {
var lat = (b[0] | b[1]<<8 | b[2]<<16 | (b[2] & 0x80 ? 0xFF<<24 : 0)) / 10000 ;
var lng = (b[3] | b[4]<<8 | b[5]<<16 | (b[5] & 0x80 ? 0xFF<<24 : 0)) / 10000;

return {

location: {
lat: lat,
lng: lng
}
}
}

And decoded value is:

{
“location”: {
“lat”: 63.3968,
“lng”: 10.4017
}
}

But it’s shown in two different devices and not caught as a GPS coordinate.


#2

Greetings, your device coordinates must be sent inside a variable’s context as specified at our REST API. Please reference an example below (numerical value is mandatory):

"location" : {
  "value": 1,
  "context": { "lat": 63.3968, "lng": 10.4017 }
}

All the best