Yes! You can use Ubidots to display real-time location of devices. To do so, you need to specify the latitude ("lat") and longitude ("lng") in the "context" of your request. So instead of sending this:


The payload should look like this:



Requests Without Location Data

Typically, this is the payload you send to Ubidots to record sensor data:

Using API Labels

curl -X POST -H "Content-Type: application/json" -d '{"temperature": 10}'{YOUR-TOKEN}

Using Variable IDs

curl -X POST -H "Content-Type: application/json" -d '{"value": "10"}'{YOUR-TOKEN}

These requests will create a single data point in the "Temperature" variable:

Requests With Location Data

If you want to add location data, then you should add a "context" property with these keys:

  • "lat"
  • "lng"

These are case-sensitive! If written differently, the Map widget won't recognize them as location points! Here the above examples but with location data:

Using API Labels

Body of the request: 

{"temperature": {"value":10,"context":{"lat":51.5,"lng":-0.11}}}

HTTP Request:

curl -X POST -H "Content-Type: application/json" -d '{"temperature": {"value":10,"context":{"lat":51.5,"lng":-0.11}}}'{YOUR-TOKEN}

Using Variable IDs

Body of the request: 


HTTP Request:

curl -X POST -H "Content-Type: application/json" -d '{"value":10,"context":{"lat":51.5,"lng":-0.11}}'{YOUR-TOKEN}

Any of these requests will create a data-point with a lat and lng context properties:

Which can be then read by a Map widget. This can be created in your dashboard --> Add new widget --> Map Widget --> Select the device that contains Position (Lat & Long) Properties.

Expectations for Visualization

It is important to note that the Ubidots real-time map display is a live interface. When you select to view a historical range of data in the Map, your historical data will appear as "dots." Any incoming real-time data will appear as a smooth "line". To update the realtime line to contain the historical data information and be presented as "dots", you need only reload the historical range of data.

Did this answer your question?