Work with ComputedLocation and visualize on a map your Sigfox devices

Locate assets it is key in some use cases. This is why Sigfox is improving their techniques to locate assets. Sigfox brings the Atlas geolocation, which is kind of the GSM cell tower triangulation with Sigfox base stations. The Sigfox Atlas location from the new API version on the DATA ADVANCED services uses the concept of computedLocation. At thethings.iO sigfox parser on Cloud Code it is very simple to parse the Sigfox computedlocation.

Sigfox made a smart movement using machine learning techniques in order to calculate location of assets with Sigfox base station triangulations. In case of base stations dense locations, the computedLocation can be “kind of” precise (about 1KM). However in places with not a lot of Sigfox base stations, it’s possible that the computedLocation error brings about 10 or 15 kms or error.

How Sigfox computedLocation works

In case that you have the Sigfox Atlas location activated on your Sigfox contract, then you can introduce a DATA_ADVANCED callback. The computedLocation structure is a JSON object and it looks like this:

{
"lat":23.783814666368414,
"lng":2.1434994169512827,
"radius":8869,
"source":2,
"status":1
}

This is the structure of the computedLocation JSON:

  • The lat is the latitude and the lng is the longitude.
  • The radius means the distance in meters that potentially the device really is located from the latitude and longitude computed. Understand the radius as the aproximate error on the location detected.
  • The source indicates the source of the location computed, if it’s Atas, WiFi or GPS. If the source is set to 0 the location is computed by legacy mode using RSSI and position of the Sigfox base station. If the source is set to 1 the location is computed using the GPS inside the data payload on the uplink. If the source is set to 2 the location is computed by Atlas Network. If the source is set to 3 the location is computed by Atlas POI and 4 by Atlas HD.
  • The status is set to 1 when a position has been computed and 0 when no position has been computed.

How to visualize computedLocation on a thethings.iO map

First of all, it is important to set up a SERVICE and DATA ADVANCED callback on the Sigfox backend.

Once there introduce thethings.iO Sigfox callback URL available on your product details and paste it there as a POST callback. Usually thethings.iO Sigfox Callback URL looks like this: https://subscription.thethings.io/sgfx/[your ID]/[your hash]?id={device}&data={data}&snr={snr}&station={station}&avgSnr={avgSnr}&rssi={rssi}&seqNumber={seqNumber}

Delete some parameters and leave it like this: https://subscription.thethings.io/sgfx/[your ID]/[your hash]?id={device}

Then paste the URL on the URL pattern and go to the Body and introduce {computedLocation}. Just like the image below.

At this moment, every time there is a message from your Sigfox device, thethings.iO will receive automatically the computedLocation by Sigfox. To make it easy we automagically store all the JSON object from Sigfox at the device as a resource, so you can see the latitude and longitude plus the radius, status and source. It’s simple!

At this point you can start playing with the dashboards from thethings.iO IoT platform. thethings.iO is the most simple enterprise IoT platform, so feel free to test it during 15 days here.