Geocode device coordinates in Thingstream with OpenCage
Background: Thingstream is an Internet-of-Things (IoT) communications platform. It makes enables organizations to collect and manage data from many IoT devices.
In this tutorial we show how to convert Thingstream device coordinates (from GPS or wifi) into location information usign a Thingstream flow and the OpenCage geocoding API
Step 2: Sign up for a Thingsteam account
Go to portal.thingstream.io and create an account.
Most of the Thingstream components that we are going to use require an upgrade to their paid platform, so add your credit card in order to be able to do HTTP requests and more.
Step 3: Create a flow
If you have a Versades VTrackL or another tracker feel free to re-use a flow from the flow library. In the case of the Versades VTrackL GPS tracker the GPS information captured is like this:
In your flow get the JSON from the JSON box and create a HTTP request box:
The OpenCage URL that you will be requesting from has the format
The URL has three parameters:
KEYYour OpenCage API key
LATThe latitude captured by the VTrackL tracker, which can be retrieved by specifying
LONThe longitude captured by the VTrackL tracker, which can be retrieved by specifying
So the final URL will look like:
Requests to the OpenCage geocoding API you will return JSON with information about the location.
A debug box with, for example,
will return a human-readable, well-formatted address of the location.
4. Get other types of information from OpenCage
We intentionally kept this guide very basic, just getting the formatted location name. But you can also get a lot more information from OpenCage - things like timezones, flag, neighbourhood name, road information, etc.
Have questions? Please get in touch
Please contact us should you have any questions about this tutorial or OpenCage in general.