GetFeatureInfo and GetFeature

12 views
Skip to first unread message

Emilio Otero

unread,
Apr 11, 2014, 7:51:31 AM4/11/14
to geoext-use...@googlegroups.com
Hi,
 
It's my problem: I want to combine the GetFeatureInfo function with the GetFeature function but I fail with it. 

for my GetFeatureInfo function I define it:


(** with an OpenLayers.ProxyHost = "../../cgi-bin/proxy.cgi?url="; **)

infoControl = new OpenLayers.Control.WMSGetFeatureInfo({
url: 'http://...',
queryVisible:true,
maxFeatures: 50
});
mapPanel.map.addControl(infoControl);
infoControl.events.register("getfeatureinfo",this,mostrarInfo);
infoControl.activate();
function mostrarInfo(evt){
$('informa').innerHTML = evt.text;
}// It works perfectly!


For the GetFeature

first the vecLayer, ( I think that like the example ):

select = new OpenLayers.Layer.Vector("Selection", {styleMap: 
                new OpenLayers.Style(OpenLayers.Feature.Vector.style["select"])
});
map.addLayers([select]);

control = new OpenLayers.Control.GetFeature({
                protocol: OpenLayers.Protocol.WFS.fromWMSLayer(layername),
});
control.events.register("featureselected", this, function(e) {
                select.addFeatures([e.feature]);
});
control.events.register("featureunselected", this, function(e) {
                select.removeFeatures([e.feature]);
});
mapPanel.map.addControl(control);
control.activate();

It works for GetFeatureInfo but it doesn't select the element in the layer about that I request information. If I make a new map only with the GetFeature function It works fine. Anyone can help me, please. Thanks.




Reply all
Reply to author
Forward
0 new messages