OpenLayers 3 Wrapper for Vaadin

OpenLayers 3 Wrapper for Vaadin is a Vaadin wrapper for the OpenLayers 3 javascript library. The add-on is currently released as beta and most of the features should already work pretty reliably. In case you have any questions or comments related to the add-on, please post them in this thread.

Link to the add-on page:!addon/openlayers-3-wrapper-for-vaadin

Hi Matti,

Firstable I have to say thank you very much for your work on OL3 Add-on For Vaadin.

I write to you because I’m working on GIS Web App and, of course, I’m using your add-on. I’ve read the code on I’ve successfully with functions for presenting layers with WMS. For that, I’m using geserver and a postgis data base as the source for all the geospatial information.

My problem is when i want to do the things in reverse way. I mean, using a presented layer obtain the information about the register in the postgis table related. For example, clicking one polygon shows the database row…

I really appreciate your help with that.

PD: Sorry for my english.

Hello Guillermo,

So which layer are you using? If you are working with FeatureLayer to show your polygons, you could try org.vaadin.addon.vol3.interaction.OLSelectInteraction to capture the feature selects. See the url below for example.

If that does not work for you, please elaborate a bit more what you are trying to achieve and which layers and sources you are using.

Best regards,

Well, I’ll try to explain better.

For a base layer i’m using OLMapQuestSource with a OLMapQuestLayerName.OSM.

The mechanism that I’m using for presenting additional layers:

  1. Invoke a method that returns OLSource based on OLtileWMSSourceOptions object.
  2. This OLSource is used in a new OLTileLayer to create a new OLLayer.
  3. This Layer is added to the map and then is shown.

Every polygon i’m showing in my map is a row in a Postgis data base. I want to implement a functionality to show the information (all columns of the table ) of a specific polygon realated to the data base row.

Thanks in advance.

Thanks for clarifications,

Unfortunately the OL wrapper does not really help you there since the shapes are drawn on tiled images already at your WMS server. The OpenLayers client (wrapper) does not have any information on what is inside the tiles.

In order to achieve your goal, you could try to use the getFeatureInfo functionality if it is provided by your WMS server. At the moment, the add-on does not really help you with that. The underlying OpenLayers JS library has some support for this (tileWMS.getFeatureInfoUrl) but it is not wrapped by the current version of the add-on. This means that you need to modify the add-on or build the corresponding functionality on server side. The best approach depends on your application. In case you decide to fork the add-on, I will happily accept pull requests for that feature.


Hi Im working on OpenLayers 3 Wrapper for Vaadin add-on to implement a simple application as shown in the demo in Vaadin Directory. But the widgetset compilation is failed. I included all the jars and required configurations. But cant find why it is giving the widgetset failed exception. Can anyone help me with this.?

What dependency management system are you using? Did you include the GWT-wrapper required by the add-on as well?


Hi Matti, Is there any way to change the format of coordinates shown by MousePositionControl of Map? I want to change from degree decimal to HDMS.

Best Regards

I made some code to made the possible to have The HDMS format on MousepositionControl.
Where i can send it ?

Hi all,

I’m been able to change the style of a given layer but I’m trying now to change the style of a specified feature unsuccessfully :(. The idea is to have the possibility of selecting a feature in a combobox and, given its Identifier, searching for it along the collection of features, and, once found it, being able to highlight it. For that reason I need to change its style (color, stroke, fill…). The code is implemented, but nothing happens! maybe it’s required to refresh the map, but I neither know to make that.

Here you have my implementation:

                   List<OLFeature> features = ((OLVectorSource)myLayer.getSource()).getFeatures();
                    for (OLFeature f : features) //loop all features in the layer
                        if(f.getId().equals(id)){//we found it!

                            f.setStyle(createStyle("#2CE32F", 2.0));//passing color and width

Any help will be appreciated!
Many thanks in advance!

I’ve just to find it out!

just I had to call to updateFeature from source object.

Thanks anyway!

Cheers, Ruben

I have touble with the styleing.
I can draw circles and it works fine, but if set a color, the circle doesnt show up.

OLStyle s = new OLStyle();
s.circleStyle = new OLCircleStyle();
s.circleStyle.stroke = new OLStrokeStyle();
s.circleStyle.stroke.color = “#FFFFFF”;
s.circleStyle.stroke.width = 3.0;
s.fillStyle = new OLFillStyle();
s.fillStyle.color = “#222333”;
s.strokeStyle = s.circleStyle.stroke;

OLFeature f = new OLFeature();
[/code]I just want to change the color, can someone please help?
if i remove f.setStyle(s); it shows up, but in the default color.

Thanks in advance

Hi, could you please post your createStyle() method.
I dont know what I am doning wrong, but when i create a style, the feature doesnt show up.

hi folks,

i try to center my OpenLayer-Map over a specific coordinate where I set a Marker.
Ther marker is displayed but the map centers over 0/0 instead of the Markers location.

To center I use following Code:

public void showLocation(double latitude, double longitude){
        OLCoordinate centerCoordinate = new OLCoordinate();
        centerCoordinate.x = longitude;
        centerCoordinate.y = latitude;;;

Zoom seems to work but center is not working, any one an Idea what the problem could be?

Hello Marc,

Maybe a coordinate space problem? Have you set input projection for your view?



To get started, you might want to have a look at:


Hmm… Try to add something like:

s.circleStyle.fill = new OLFillStyle(“#222333”);


Did you try OLMousePositionControl.projection = “EPSG:4326” already?


Nevermind, I thought you were after normal lat/lon coordinates, but clearly HDMS is a bit different representation. Unfortunately it is not currently supported by the wrapper. Maybe you would like to contact Mr Claudio Pulerà (see above) and ask whether he is willing to share his solution with you.


Hello Claudio,

Sorry for late answer. You can just send a pull request in github. I’ll have a look and if your solution is generic enough, I’ll be happy to include it in the master branch. That way the user community of the add-on could use your solution in any case.