[OpenLayers-Users] store getfeatureinfo results in variables

Roald de Wit roald.dewit at lisasoft.com
Thu Nov 5 06:13:47 EST 2009


Hi  stash,

stash wrote:
> Hi Roald,
> thanks for your answer. I know it would be much easier if I used a wfs
> getfeature instead of a wms getfeatureinfo. But the problem is that my
> proxyhost doesn't work (I don't know why and I spent so much time in solving
> this problem), therefore I want to solve my problem with a wms.
>
> You wrote that it is sometimes possible to get a xml back even with wms.
> What do you mean by this?
>   
Different WMS servers have different output formats for GetFeaturInfo. 
IIRC you are using GeoServer. If that is correct, you can specify the 
INFO_FORMAT to be 'application/vnd.ogc.gml', then you could pass the 
output to the OL GML reader which looks a bit like this:

var gmlReader = new OpenLayers.Format.GML();

var features = gmlReader.read(data); // assuming the result of the 
output is in the variable called data

Then you can loop through the features and change the attribute 
information any way you like and visualise it any way you want.

Regards, Roald




More information about the Users mailing list