[OpenLayers-Users] Problem with GetFeature Control

Julio Vega oilagex at gmail.com
Fri Feb 11 02:07:37 EST 2011


Hi I want to use the GetFeature control in a fresh mapfish app. I have
configured the protocol of the control, and added a WMS as a simple base
layer with the same projection and displayprojection ("EPSG;4326"). I use
geoserver.

With firebug I have seen that the control does the WFS POST request to
geoserver, and geoserver gives back the gml document (I think then the proxy
is not the problem because I can get the geographical features, I put the
application inside geoserver folder in apache), the problem comes with the
featuresselected event because I have put into the event an alert and it
doesn't show, I paste the code here, for any further reference. (I get it
from the official mapfish documentation). What could be wrong?.

I thank your time and attention.

Thank you very much.

         var featureControl = new OpenLayers.Control.GetFeature({
                //strategies: [new OpenLayers.Strategy.BBOX()],
        protocol: new OpenLayers.Protocol.WFS({
                    version: "1.1.0",
            url:  "http://localhost:8080/geoserver/wfs",
            featureType: "ways",
            featureNS: "simulador",//
http://localhost:8080/geoserver/rest/proxy?url=simulador.trafico
            srsName: "EPSG:4326",
            maxFeatures:50
        }),
                box: true,
                hover: true,
                multipleKey: "shiftKey",
                toggleKey: "ctrlKey",
                multiple: true,
               allowSelection:true
            });

         *//I have tried this way*

        featureControl.events.on({
            'featuresselected': function(e){
            alert('dfsfds');
            }
        });

      * //And also this way*
         featureControl.events.register("featuresselected", this,
function(e) {
        alert("lkjlk");
                selectLayer.addFeatures([e.feature]);
            });
            featureControl.events.register("featureunselected", this,
function(e) {
        alert("lkjlk");
                selectLayer.removeFeatures([e.feature]);
            });
            featureControl.events.register("hoverfeature", this, function(e)
{
        alert("lkjlk");
                hoverLayer.addFeatures([e.feature]);
            });
            featureControl.events.register("outfeature", this, function(e) {
        alert("lkjlk");
                hoverLayer.removeFeatures([e.feature]);
            });*/
            //map.addControl(featureControl);
        //featureControl.activate();

        //This is the actions array for the toolbar
        actions.push(new GeoExt.Action({
            iconCls: "info",
            map: map,
            toggleGroup: "map",
            tooltip: "Get country information",
            control: featureControl
        }));
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20110211/5216ce17/attachment.html


More information about the Users mailing list