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.
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 https://github.com/VOL3/v-ol3. 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…
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.
For a base layer i’m using OLMapQuestSource with a OLMapQuestLayerName.OSM.
The mechanism that I’m using for presenting additional layers:
Invoke a method that returns OLSource based on OLtileWMSSourceOptions object.
This OLSource is used in a new OLTileLayer to create a new OLLayer.
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.
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.?
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:
if(myLayer.isVisible()){
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!
Cheers,
Ruben
Hi,
I have touble with the styleing.
I can draw circles and it works fine, but if set a color, the circle doesnt show up.
[code]
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();
f.setGeometry(p);
f.setStyle(s);
[/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.
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;
this.map.getView().setCenter(centerCoordinate);
this.map.getView().setZoom(5);
}
Zoom seems to work but center is not working, any one an Idea what the problem could be?
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.
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.