[OpenLayers-Users] split WMS GetFeatureInfo results

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


One more addition: you can also use a GetFeature control with the new 
OpenLayers.Protocol.WFS.fromWMSLayer protocol.
That's probably a cleaner way, but you'd have to find out how to add 
extra paramaters like 'propertyName' and you'd still need to loop 
through the attributes and show them.
Here is a standard GetFeature example using WFS: 
http://www.openlayers.org/dev/examples/getfeature-wfs.html

Roald de Wit wrote:
> 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
>
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>   




More information about the Users mailing list