[OpenLayers-Users] split WMS GetFeatureInfo results

Roald de Wit roald.dewit at lisasoft.com
Wed Nov 4 07:14:06 EST 2009


Hi stash,

stash wrote:
> Hello,
> thanks for your answer. I use geoserver and therefore I could use WFS too.
> But with a WFS you get only a xml (gml) I thought and i want to display the
> featureinfo. is this possible with wfs, too?
>
> Could you show me an example of how to integrate such an wfs (getfeature) in
> openlayers to show the clicked value on my map. I know that I can use a
> filter with wfs, but I don't know how to use it with openlayers.
>   
I'm realising now that I answered a bit too quickly: you would need to 
perform some tricks to do a GetFeature request, including transforming 
the click coordinates to lon/lat values etc. As a punishment for myself 
I created an example [1] based on the standard getfeatureinfo.html 
example. It's not perfect, but it works :-)

A few things to look out for:
- use 'ows' in your url instead of 'wms' or 'wfs'. OWS captures both, 
you just need to specify the service explicitly
- make sure that if your geoserver runs on another port or another 
machine that you have a proxy script
- look at the 'propertyName' parameter. That one tells the WFS service 
what attributes to return.

[1] http://pastebin.com/f10237f96

Good luck!

Roald





More information about the Users mailing list