I'd like to integrate OSM in GWT. I found this library called gwt-openlayers, but I don't understand how can I make it work with the OSM map.
Can anyone provide me a short example?
Make sure you inherit from gwt-openlayers by adding the following to your module file:
<inherits name='org.gwtopenmaps.openlayers.OpenLayers'/>
Also make sure you bring in the OpenLayers javascript library and OpenStreetMap OpenLayers into your application by adding the following lines in "Application.html" page:
<script src="http://www.openlayers.org/api/OpenLayers.js"></script>
<script src="http://www.openstreetmap.org/openlayers/OpenStreetMap.js"></script>
Then it should a simple thing to create a layer that uses open street maps:
OSM openStreetMap = OSM.Osmarender("Base Map");
openStreetMap.setIsBaseLayer(true);
MapWidget mapWidget = new MapWidget("350px", "350px");
mapWidget.getMap().addLayer(openStreetMap);