Table of Contents
Table of Contents
This plugin enables searching a location on the map.

The default widget allows the user to type (part of) a location in a text box. When striking the enter key or clicking the magnifying glass, the input is passed to one or more server-configured geocoder services. If they return one result, the full name is displayed and the map is zoomed to that location.
![]() |
When more than one possible location is returned, the default widget shows the list in a separat window. The user can select the location of choice by clicking. Again, the map is zoomed to the chosen location.
![]() |
When no location is found, the default widget will show a warning message.
![]() |
In order to use this plug-in in combination with the client GWT2, the following Maven dependency is required:
<dependency>
<groupId>org.geomajas.plugin</groupId>
<artifactId>geomajas-client-gwt2-plugin-geocoder</artifactId>
<version>2.1.0-M3</version>
</dependency>
This in turn includes a dependency on the Geomajas server project (i.e. geomajas-plugin-geocoder).
This chapter shows how to create and use the default Geocoder Widget.
The default Geocoder widget is class org.geomajas.gwt2.plugin.geocoder.client.widget.GeocoderWidget.
The following code creates the Geocoder Widget and
defines the position of the widget on the map:
GeocoderWidget geocoder = new GeocoderWidget(mapPresenter); geocoder.asWidget().getElement().getStyle().setTop(7, Style.Unit.PX); geocoder.asWidget().getElement().getStyle().setLeft(100, Style.Unit.PX);
Alternatively, the position can be set in the constructor:
GeocoderWidget geocoder = new GeocoderWidget(mapPresenter, 7, 100);
The geocoder widget can be loaded with empty css classes. This can be achieved by setting the resource bundle factory <emphase>before</emphase> creating the widget:
Geocoder.getInstance().setBundleFactory(new ExampleClientBundleFactoryNoStyle()); // create the widget GeocoderWidget geocoder = new GeocoderWidget(mapPresenter);
Table of Contents
As with most Geomajas plugins, the geocoder plugin has a single class that provides access to all the configurable functionalities within the plugin:
org.geomajas.gwt2.plugin.geocoder.client.Geocoder
This class provides access to the client bundle factory and view factory that are used in the creation of the Geocoder Widget. Both factories can be overwritten by customized classes.