All tutorials

How to add the what3words Java API for GE Smallworld

intermediate

This guide describes how to use what3words Java API for GE Smallworld. GE has a long and successful track record in utilities. It has similar capabilities to most GIS software. Because it specialises in network infrastructure, you get value-added tools specifically for networking.
GE Smallworld is completely written in Magik. Magik is an object-oriented programming language and can be stand-alone applications on their own. The what3words Java API module uses the Magik-Java Interoperability, a supported mechanism to call code written in Java™ from GE Smallworld. This provides an efficient way of exposing Java to Magik, allowing access to existing Java code and third-party libraries written in Java.

Your project could be separated into two parts, the Java module part which is used to implement the what3words class, and the Magik part where the plugin is implemented. The Java class is available here.

This module has been tested on Smallworld 5.2.8

Resources: Implementation of what3words Java API for GE Smallworld is available in this GitHub repository and as a video tutorial.

1
2

What can you do with what3words Java API for GE Smallworld

  • Users can select different languages on the toolbar;
  • Users can search what3words address on the toolbar;
  • Users can use the AutoSuggestion functionality on the search bar to find the right what3words address;
  • Users can convert a what3words address typed on the search bar to a point feature on the map (convert to coordinate);
  • Users can tap on the map to get any what3words address (convert to what3words address);
  • Users can display the what3words address on the selection status bar pane at the bottom of the map;
  • Users can use the backward or forward buttons on the what3word toolbar to search for a what3words selection;
  • Users can display all the what3words addresses that have been searched using the what3words history viewer plugin;
  • Users can display the what3words grid on the map by enabling the grid icon.
3

Installation

To install this plugin, make sure you follow these steps:
1. Copy the what3words folder to a directory such as %SMALLWORLD_GIS%/../

2. Add this folder to the LAYERED_PRODUCTS file in %SMALLWORLD_GIS%\..\smallworld_registry directory
what3words:
path = %SMALLWORLD_GIS%\..\what3words\
version = 5.2.8

3. Add this code to the config.xml of the Application:

<plugin name="what3words_pushpin_renderer" class_name="what3words_pushpin_renderer">
     <properties>
        <!-- Display mode can be words or coordinate - comment out the functionality that you don't need -->
        <property name="display_mode" value="words" />
        <!-- <property name="display_mode" value="words_and_coordinate" />
        <property name="display_mode" value="words" />
        <property name="display_mode" value="coordinate" />  -->
        <property name="grid_colour" value="808080" />
     </properties>
</plugin>

<plugin name="what3words_plugin" class_name="what3words_plugin">
     <properties>
        <property name="api_key" value="YOUR_API_KEY" />
        <property name="language" value="en" />
        <property name="maximum_number_of_auto_suggestions" value="10" />
        <property name="clip_to_country" value="GB,FR" />
        <property name="one_shot_interaction_mode" value="false" />
        <property name="what3words_pushpin_background_colour" value="ff0000" />
    </properties>	
    <export>
      <toolbar source_name="what3words"/>
    </export>
</plugin>

<plugin name="what3words_search_history_viewer" class_name="what3words_search_history_viewer_app_plugin"/>
Copied

4. Copy the what3words API key from your what3words account and paste it into the api_key property

5. Add this code to the gui.xml of the Application:

<dock name="top">
   <toolbar name="what3words"/>
   <section/>
   <super/>
</dock>
Copied

6. Add what3words Search History Viewer Plugin to the work_area

<plugin plugin_name="what3words_search_history_viewer"/>

for the what3words Cambridge application, the changes are as shown on this screenshot.

The what3words toolbar would be displayed on the GE Smallworld platform.

4

Select different languages on the toolbar

The what3words application is available in multiple languages. Users can choose their language from the dropdown menu, as it is shown here.

6

Autosuggestion of 3 word addresses

When users type a 3 word address on the search bar that may be incorrectly entered, the what3words autosuggestion functionality will return a list of potential correct 3 word addresses. The user will need to enter the first two words plus at least the first character of the third word to get the list of suggestions, e.g. filled.count.s . This method provides corrections for mistyped words (including plural vs singular), and words being in the wrong order. When a user is happy with the selection of the what3words address, it can click the green play button next to it to display it on the map.

7

Convert a 3 word address to coordinates

Users can convert a what3words address, e.g. filled.count.soap, to a position, expressed as coordinates of latitude and longitude. It will be displayed as a pop-up message on the map with the what3words address.
You will need to update the properties mentioned above in the config.xml of the Application. Then restart the Application to see the changes applied to the plugin.

Note: The what3words address is visible on the selection status bar pane located at the bottom of the map.

8

Convert coordinates to a 3 word address

Users can tap anywhere on the map to retrieve a what3words address. It will be displayed as a popup message on the map. Any coordinates on the map (expressed as latitude and longitude) get converted on the fly to a what3words address.

9

Display what3words History Viewer Plugin

You can also enable the what3words History Viewer plugin that will allow you to display all the what3words addresses that you have been searching on the map. But this plugin can do much more such as:

  • Storing all the what3words addresses directly searched or inspected on the map;
  • Displaying all the queried what3words addresses in the list;
  • Highlighting what3words addresses from the list;
  • Create a trail of the what3words addresses;
  • Go to the location of the what3words addresses;
  • Copy what3words addresses;
  • Copy coordinates of the what3words addresses.
10

Display what3words Grid

To display the 3m x 3m what3words Grid on the map, you need to enable the Grid icon on the toolbar as shown on this screenshot.
Also to be noticed that whenever you change your coordinate system the grid will be also reprojected using the new coordinate system.

GISDisplay a 3 word addressUse 3 word addresses with a mapUse 3 word addresses within a GISGE Smallworld

Related tutorials