vopenlayers does not show map

First of all I’m very new to the concept of widgets. I’ve created a new maven module in my project with the vaadin arch-type clean and vaadin 6.8.7. Now I had a look at the example at http://code.google.com/p/vopenlayers/source/browse/#svn%2Fexampleapp and tried a few steps on my own: here is my DemoApplication.java:

public void init() {
        OpenLayersMap map = new OpenLayersMap();
        map.setImmediate(true); // update extent and zoom to server as they
        OpenStreetMapLayer osm = new OpenStreetMapLayer();

        map.setCenter(52.5233, 13.4127); // this should be berlin
        layout.setExpandRatio(map, 1);

The DemoApplicationWidgetSet.gwt.xml:

    <inherits name="org.vaadin.vol.VolWidgetsetWithHostedScript" />
    <inherits name="com.vaadin.terminal.gwt.DefaultWidgetSet" />

I’ve run mvn vaadin:update-widgetset and compile the widget set successfully. Now if i go to http://localhost:8080/demo all I see is a grey page with the zoom buttons. If i click on the zoom in button the world map is loaded at a minimum zoom level. Also, If i would add the GoogleStreetMapLayer, only the OpenStreetMap layer is available.

What am I doing wrong?


Don’t know what could cause that grey page. I’d first encourage to check you use the latest version (1.3.0). Then if it doesn’t work, please file an issue report to the project page with code example so I or someone else working with the project can try to repeat it.

I have once heard of a case where the hosted version of the script didn’t work. Apparently openlayers.org block some addresses causing heavy load. This might be one possible cause. In this case you should use the “non hosted” module and serve openlayers.js from you own server.

For google layer you need to add google map script like this:


Awesome! Thank you Matti!
This fixed the issue and the map is shown at the right point/zoomlevel.
One suggestion so, you should update your pom definition
to 1.3.0

One slightly unrelated question, what would I need to change to let the “Data CC-by-SA by OpenstreetMaps” appear like the Google Disclaimer as far down right as possible?

Thanks again!


Ensure there is Control.Attribution in your controls. It should be by default, but there might be a regression.

And you are right, I definitely should update the example project some day…