<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-15">
<META content="MSHTML 6.00.2900.3243" name=GENERATOR></HEAD>
<BODY>
<DIV>Once you have parsed out the response from your WMS GetFeatureInfo request, you can use the result to send a WFS GetFeature request.</DIV>
<DIV> </DIV>
<DIV>Here is a GetFeature request which uses a farmid= variable to send a where filter condition:</DIV>
<DIV> </DIV>
<DIV>var othptsurl = "<A href='http://wfsserver/cgi-bin/agbwfs.exe?farmid="+farmid+"&request=getfeature&typename=otherpoints&service=wfs&version=1.0.0&BBOX=773500,4555450,2602100,6384050'>http://wfsserver/cgi-bin/agbwfs.exe?farmid="+farmid+"&request=getfeature&typename=otherpoints&service=wfs&version=1.0.0&BBOX=773500,4555450,2602100,6384050</A>";<BR>OpenLayers.loadURL(othptsurl, '', this, othptsreturn);</DIV>
<DIV> </DIV>
<DIV>And here is turning the response into a Vector layer:</DIV>
<DIV> </DIV>
<DIV>var gml_format = new OpenLayers.Format.GML();</DIV>
<DIV>function othptsreturn(response) {<BR> var oFeatures = gml_format.read(response.responseText); <BR> var othptsl = new OpenLayers.Layer.Vector("Other Points",<BR> {isBaseLayer: false,<BR> styleMap: othStyles, <BR> extractAttributes: true });<BR> othptsl.addFeatures(oFeatures);<BR> map.addLayer(othptsl);</DIV>
<DIV>}<BR></DIV>
<DIV>regards,</DIV>
<DIV> </DIV>
<DIV>Robert S </DIV>
<DIV><BR>>>> <ahwangyuwei@sina.com> 8/04/2010 1:50 p.m. >>><BR> I'm using WMSGetFeatureInfo to get Featureinfo.<BR>How can I get Feature from the WMSGetFeatureInfo 's response?<BR>And add them to map?<BR>I am imitating the Control <A href="http://dev.openlayers.org/releases/OpenLayers-2.8/doc/apidocs/files/OpenLayers/Control/WMSGetFeatureInfo-js.html#OpenLayers.Control.WMSGetFeatureInfo">OpenLayers.<DEFANGHTML_WBR>Control.<DEFANGHTML_WBR>WMSGetFeatureInfo</A>'s bahavior.<BR>It's available?<BR><BR> map.events.register('click', map, function (e) {<BR> document.getElementById('nodelist').innerHTML = "Loading... please wait...";<BR> var params = {<BR> REQUEST: "GetFeatureInfo",<BR> EXCEPTIONS: "application/vnd.ogc.se_xml",<BR> BBOX: map.getExtent().toBBOX(),<BR> X: e.xy.x,<BR> Y: e.xy.y,<BR> INFO_FORMAT: 'text/html',<BR> QUERY_LAYERS: map.layers[0].params.LAYERS,<BR> FEATURE_COUNT: 50,<BR> Layers: 'CHN',<BR> Styles: '',<BR> Srs: 'EPSG:4326',<BR> WIDTH: map.size.w,<BR> HEIGHT: map.size.h,<BR> format: format};<BR> updateFeatureInfoFilters(params);<BR> OpenLayers.loadURL("http://159.226.13.203:8080/geoserver/wms", params, this, setHTML, setHTMLx);<BR> OpenLayers.Event.stop(e);<BR> });<BR> }<BR> var parseformat= new OpenLayers.Format.WMSGetFeatureInfo();<BR>function setHTML(response){<BR> document.getElementById('nodelist').innerHTML = response.responseText;<BR> <BR> var doc = response.responseXML;<BR> if(!doc || !doc.documentElement) {<BR> doc = response.responseText;<BR> }<BR> <BR> var features = parseformat.read(doc);<BR> highlightLayer.addFeatures(features);<BR><BR> <BR> };<BR><BR><BR><BR></DIV><FONT style="BACKGROUND-COLOR: #ffffff">
<P align=center><FONT style="BACKGROUND-COLOR: #ffffff">Click <A href="https://www.mailcontrol.com/sr/wQw0zmjPoHdJTZGyOCrrhg==">here</A> to report this email as spam.</FONT></P></FONT><br><br>
<P align=center><FONT style="BACKGROUND-COLOR: #ffffff">This message has been scanned for malware by SurfControl plc. </FONT><A href="http://www.surfcontrol.com/"><FONT style="BACKGROUND-COLOR: #ffffff" color=#000000>www.surfcontrol.com</FONT></A></P>
</body></HTML>