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 variable containing lat and lng properties in context.

Keywords: GPS, Map, Location, Position.

Did this answer your question?