We are going to namespace all our what3words functions with "w3w" to help keep our code a bit cleaner. We also have a variable "w3wApiKey" which will store our API key. Replace this if you want to use this in your own applications.

Lets start by creating a layer where our pointer will be drawn when a user clicks on the map. We'll try to be a bit fancy, overlying multiple styles to give us a pointer that looks like

Lets create our layer which will show the surrounding points. It will have single "title" field which we will use as the point label. We will create the layer using a combination of JSON attributes object and TreeVectorLayerEntity.setFields()

When the user clicks the "Show Surrounding Words" button, we'll zoom into the last clicked location and draw the surrounding points. If they havent clicked anywhere yet, then we'll zoom into the middle of the screen.