I am trying to follow this example
-http://trac.openlayers.org/wiki/Highlighting to highlight a feature
using
WFS. I have both WFS/WMS setup with the same features. My code is the
same
as the example and I tried to do the request manually by copying the
code
being generated from the highlight method and it works (returns specific
information about the one feature I want to highlight). However when
I run
the code it does not highlight my layer. Maybe I am confused I am
displaying
the WMS layer in my map but I am doing the WFS request on the wfs
layer is
it supposed to be different? Or should I just be calling this highlight
method from elsewhere? Thanks for advice, here is my code :
// define a blank Vector layer and add it to the map
var highlight_style = { fillColor:'#99CCFF', strokeColor:'#3399FF',
fillOpacity:0.7 };
hilites = new OpenLayers.Layer.Vector("Highlighted",
{isBaseLayer:false, features:[], visibility:true,
style:highlight_style}
);
map.addLayer(hilites);
// define the WFS server which will fill requests
var wfs_url =
'http://localhost/RedWFS/Request.aspx?&SERVICE=WFS&request=GetFeature&VERSION=1.1.0';
/* highlightFeatures() makes the WFS request, then highlight_them()
callback does the real work
* Args for WFS filter: typename, attribute, value
*/
function highlightFeatures(typename,attribute,value)
{
var wfsurl = wfs_url + '&typename=' + typename +
'&filter=<ogc:Filter
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:gml="http://www.opengis.net/gml"'
+ '
xmlns:gmgml="http://www.intergraph.com/geomedia/gml"><ogc:PropertyIsEqualTo><ogc:PropertyName>'
+attribute+'</ogc:PropertyName><ogc:Literal>'+value+'</ogc:Literal></ogc:PropertyIsEqualTo></ogc:Filter>';
OpenLayers.loadURL(wfsurl,'',null,highlight_them);
alert(wfsurl);
}
function highlight_them(response)
{
// use the GML parser to turn the XML into
a list
of Feature objects
var features = new
OpenLayers.Format.GML().read(response.responseText);
// have the Vector layer purge its feature
list,
replace them with the new ones
hilites.destroyFeatures();
hilites.addFeatures(features);
hilites.setVisibility(true);
}
highlightFeatures('WWW_PARCELS','Orig_addrkey','REICHLEY ST 43');