I am using GeoServer and OpenLayers, and new to both. I am trying to highlight features using an OpenLayers control on a WMS layer from GeoServer. According to the response to the GetFeature request in Firebug, the numberOfFeatures=“0”. Can someone make a suggestion as to what the problem may be? The code is below:
var highlightLayer = new OpenLayers.Layer.Vector(“Highlighted Features”, {
styleMap: myStyles,
displayInLayerSwitcher: false,
isBaseLayer: false
}
);
var highlightControl = new OpenLayers.Control.GetFeature({
protocol: OpenLayers.Protocol.WFS.fromWMSLayer(mylayer),
box: false,
hover: false,
maxFeatures: 20
});
highlightControl.events.register(“featureselected”, this, function(e) {
highlightLayer.addFeatures([e.feature]);
});
highlightControl.events.register(“featureunselected”, this, function(e) {
highlightLayer.removeFeatures([e.feature]);
});
map.addControl(highlightControl);
highlightControl.activate();
The portion of the GeoServer log from the request is below:
2013-03-04 13:49:09,373 INFO [geoserver.wfs] -
Request: getServiceInfo
2013-03-04 13:49:09,388 INFO [geoserver.wfs] -
Request: getFeature
service = WFS
version = 1.1.0
baseUrl = http://myhost/geoserver/
query[0]:
filter = [ bbox POLYGON ((-8933564.1969439 4710806.2675763, -8933564.1969439 4710854.040719, -8933516.4238013 4710854.040719, -8933516.4238013 4710806.2675763, -8933564.1969439 4710806.2675763)) ]
srsName = EPSG:4326
typeName[0] = {http://myhost/workspace}layer
maxFeatures = 20
outputFormat = text/xml; subtype=gml/3.1.1
resultType = results
Any help you may provide is greatly appreciated.
Thanks.