Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
OpenLayers3 for Vaadin
Hello, Actually i'm working on a projet which use OpenLayers3 and vaadin. I'm new and i begin at this moment. I can't speak english easily so excuse me for my english language. I saw example code OL3 for Vaadin but doesn't work for me.. I want just display a map on my application web.
On my project Maven, I added depency OL3.
Then I used :
VerticalLayout layout = new VerticalLayout();
// create map instance
OLMap map = new OLMap();
// add layer to map
OLMapQuestSource mapSource = new OLMapQuestSource(OLMapQuestLayerName.OSM);
OLTileLayer layer = new OLTileLayer(mapSource);
map.addLayer(layer);
// add the map to the layout
layout.addComponent(map);
With imports :
import org.vaadin.addon.vol3.OLMap;
import org.vaadin.addon.vol3.source.OLMapQuestSource;
import org.vaadin.addon.vol3.layer.OLTileLayer;
import org.vaadin.addon.vol3.client.source.OLMapQuestLayerName;
And also, I created my own widgetset which include : <inherits name="org.vaadin.addon.vol3.WidgetSet" />
When I launch my application web, i have no errors but nothing display on my screen..
Help me please :)
I fixed my problem, now i would like to set marker (layer). Do you have an example to set a layer ? (for example, a star ?) Which class I have to use ?
There is someone here ? :p
I solved this problem, now i have a new difficulty.
I explain you, I have 2 Layers ( for points and the other for polygon ) :
private OLVectorLayer layerPoint ;
private OLVectorLayer layerPoly ;
I added interaction points and polygon :
map.addInteraction (new OLDrawInteraction ( layerPoint , OLDrawInteractionOptions.DrawingType.POINT ) ) ;
map.addInteraction(new OLDrawInteraction(layerPoly, OLDrawInteractionOptions.DrawingType.POLYGON));
And a selection mode to select the features :
map.addInteraction ( selectionFeature ());
private OLSelectInteraction selectionFeature () {
OLSelectInteraction clickInteraction OLSelectInteraction = new ();
clickInteraction.addSelectionChangeListener (new SelectionChangeListener () {
@Override
public void selectionChanged ( List < String> selectedFeatures ) {
Notification.show ( " Id " + selectedFeatures.get (0) ) ; }
});
}
With this code , I retrieve the id of the current feature but not the object of the class. So I do not know if there is a point or polygon (I repeat , I have 1 layer for points and another for the polygon .
How can I find this information? Thank you , I need your help
Hi,
Care to post how you've solved your problem with the map not being displayed? I have the same problem, I have no map but the zoom controls are displayed. I am using vaadin in an osgi environment.
Maybe you should change your getMap ? take an other map.
You know what is the version of OpenLayers 3.x we are using ?