Integrating What3Words with DronaHQ

You can integrate What3Words with DronaHQ Studio. With this feature you will be able to use the powerful digital geocoding system of What3Words. What3words doesn’t simply utilize addresses however whole areas that are set apart in three-by-three meters squares and allocate three remarkable words to it.

Configuring Word3Words connector

To add a third-party API connector, under Studio > Connectors, click (+) Connector. Select What3Words connector.

Select Connect What 3 Words.

Provide a name for your connector environment and provide the API key of your What3Words account. You can get your API key from here.

Click Save.

After this, your account will be configured.

image

Here you can also Edit the configured account or delete an existing configured account.

  • Now Configure connector fields. Add a Connector name. Then add the API key for the connector account.

  • Once all details are added, click Finish. Your connector configuration is now done.

Using What3Words connector

Now that you have configured your What3Words API Connector, you will have two endpoints under What3Words which you can apply in your apps as connectors or actions from the server-side.

The endpoints of What3Words, you can view them in your connector list page.

Get location from three words

We will use map control and set its data from the What3Words connector and use the GetLocationFrom3Words endpoint. This will convert 3-word addresses to coordinates and return you a location for your three words.

  1. Put map control and input text control in your app.

  2. We will add actionflow in input control’s value_change event In that, we will call the endpoint of What3Words, reconstruct the required data from the endpoint, and set the values for the Map control.

  3. Add the server-side action of What3Words and bind its 3 Words section to the input text control’s keyword.

  4. Click Continue and in the next step add variables to the required responses to use it later. Then click Finish.

    image

  5. In the next step, we will add a client-side action of JS Code which will help to reconstruct the output from the What3Words endpoint into the expected format of the map control.

  6. In the above image, the JavaScript is using the output of the API call and restructuring it into an array format with two attributes of location and name which has data of latitude and longitude and the name of the place respectively.

  7. Next, click Continue and save the output in a variable then click Finish.

  8. Now we have to set the output as data to the map control by using the Set Control Value action.

    image

    image

  9. Save the app and click preview and enter three words.

    NOTE: Every word should have “. ” between them.

Get three words from the location

We will use text input control and bind its data to the What3Words connector and use the Get3WordsFrom Location endpoint. This will convert coordinates to 3-word addresses and return you three words for your location. We will also be needing GPS control to get the latitude and longitude of a location.

  1. Put GPS control and input text in your app.

  2. Go to the bind data section of text input control and select connectors and click What3Words.

  3. Click the Get3WordsFromLocation endpoint and then select your environment.

  4. In the next step fill the section of Co-ordinates with latitude and longitude which we will receive from the GPS control using its keyword. You can also bind it with keywords of some other input control.

    NOTE: Pair of co-ordinates should have “,” between them.

  5. Do a Refresh Response. Then bind the connector keys.

  6. Click Test & Finish.

    image