Adding GPS Devices


In this tutorial we will show you how to connect devices to the Datacake Cloud that provide GPS coordinates and how you can use these coordinates on the platform.

Create a Location Field

First of all we need to add a Field of the type "Location" to your Device. This field will store a pair of latitude and longitude and you can use this field type for different actions on the portal.

Use the tab bar to navigate to the configuration of your respective API device and scroll down until you reach the Field section.

There you create a new field by clicking on the "Add field" button.

You should see the following dialog which asks you for putting in the details to create a new field.


This is the descriptive name for the field. You can choose a free name here and change it later as required.


The identifier uniquely describes the field for identification in the database. The identifier cannot be changed afterwards. If you still want to change it, you must first delete the field and then recreate it.


Select the "Location" type from the drop-down menu.

Unit / Formula

This setting can be ignored. If entries are made here, they are ignored by the portal.

Format your Location Data

The Datacake Portal and the Location-Field requires that you structure the data you want to store in the field accordingly. This structure looks as follows:




Please make sure that you use a "comma" to separate latitude and longitude, as shown in the example above and in the following code snippet.

// Example of Latitude and Longitude payload formatting
var lat = 52.03792
var lon = 6.828
var payload = {
location: "("+ lat +","+ lon +")"
// payload = { location: "(52.03792,6.828)" }

Create Dashboard

On the dashboard, you can use the map widget to display the current position. This widget also works on the app. Dashboards with maps are therefore also displayed on the app.

Edit Widget

To assign your location field to the widget, open the widget settings and select the appropriate field.


Does Datacake support Geofencing?

Not yet. We are working on a rule that reacts on changes in location the send out alerts via SMS, E-Mail or Push when for example a position has left a "geofence".

Are position changes stored in the database?

Yes, you can retrieve the historical history of your positions from the database and use it for your own presentations. We are currently working on a widget which displays the course of the position as a route and which offers further options.

Example Payload Structures

Dragino LGT-92

The following code snippet can be used to decode the raw payload coming from a Dragino LGT-92 and convert it into a payload that can be used by TTN integration on the Datacake platform.

function Decoder(bytes, port) {
var lat = (bytes[0]<<24 | bytes[1]<<16 | bytes[2]<<8 | bytes[3]) / 1000000;
var lon = (bytes[4]<<24 | bytes[5]<<16 | bytes[6]<<8 | bytes[7]) / 1000000;
return {
position: "("+ lat +","+ lon +")",
alarm: (bytes[8] & 0x40) > 0,
BatV: ((bytes[8] & 0x3f)<<8 | bytes[9]) / 1000,
md: {
"0": "Disable",
"1": "Move",
"2": "Collide",
"3": "Custom"
roll: (bytes[11]<<24>>16 | bytes[12]) / 100,
pitch: (bytes[13]<<24>>16 | bytes[14]) / 100,