All tutorials
How to add the what3words Java API for GE Smallworld
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.
- 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.
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"/>
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>
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.
The what3words application is available in multiple languages. Users can choose their language from the dropdown menu, as it is shown here.
Users can search what3words address on the search bar. On the toolbar, the backward and forward buttons allow users to easily navigate the what3words addresses that have been searched on the search bar.
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.
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.
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.
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.
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.
If you encounter errors or issues related to convert-to-coordinate requests while using the Free plan, please check the network panel for the following error message Error 402 payment required
and its response, indicating the need to upgrade to a higher plan:
{ "error": { "code": "QuotaExceeded", "message": "Quota Exceeded. Please upgrade your usage plan, or contact support@what3words.com" } }
For more information, visit our API plans page. If you need further assistance, contact support@what3words.com.