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 exist 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.1.9.

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 copy the what3words address from the pop-up displayed on the map;
  • 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.
3

Installation

To install this plugin, make sure you follow these steps:
1. Copy these files in their specified directories:

  • copy swj_magik_what3words_module in Magik_Module folder to the %SMALLWORLD_GIS%\interop.demo\interop_demo_product\modules\
  • copy contents of the “Final Jar Files, Exported from Java Project” folder’s Jar files to %SMALLWORLD_GIS%\interop.demo\interop_demo_product\libs\

2. Type this command on the command line:

smallworld_product.add_product(:interop_demo_product)

3. Compile the modules;

4. Add this code to the config.xml of the Application;

<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="use_floating_info_window" value="true" />
   </properties>    
   <export>
       <toolbar source_name="what3words"/>
   </export>
</plugin>
Copied

5. Copy the what3words API key from your what3words account and paste it in the api_key property

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

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

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. A Copy button, next to the what3words address, is available to easily copy the what3words address.

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.

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

Related tutorials