Tell me more ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am having problems with my popups. On two layers they are showing (wfsLayer and wfsLayer1), on the other layer they aren't (wfsLayerBasic). wfsLayerBasic are new points which have been saved into my database with wfs-t. My hover function works, the features lighten up when hovering but no popup is shown. Can someone help me with this problem? I just don't get this, the code is identical..not even a emptry popup is showing.

(...)

       //wfsLayerBasic
    var wfsLayerBasic = new OpenLayers.Layer.Vector("Basic", {
        eventListeners:{
        'featureselected':function(evt){
            var feature2 = evt.feature;
            var popup = new OpenLayers.Popup.FramedCloud("popup",
                OpenLayers.LonLat.fromString(feature2.geometry.toShortString()),
                null,
                '<div>Bezeichnung: '+feature2.attributes.bez +'</div>',
                null,
                true
            );
            feature2.popup = popup;
            map.addPopup(popup);
        },
        'featureunselected':function(evt){
            var feature2 = evt.feature;
            map.removePopup(feature2.popup);
            feature2.popup.destroy();
            feature2.popup = null;
        }
        },
        strategies: [new OpenLayers.Strategy.BBOX(), saveStrategy],
        styleMap: new OpenLayers.StyleMap({ 
                "default": new OpenLayers.Style(null, {rules: [rule_basic]})}),
        protocol: new OpenLayers.Protocol.WFS({
                    url:  "http://localhost:8080/geoserver/wfs",
                    featureType: "bochumtest11",
                    featureNS: "bochum_namensraum",
                    featurePrefix: "bochum_arbeitsbereich",
                    geometryName: "the_geom",
                    srsName: "EPSG:900913",
                    version: "1.1.0",
                    schema: "http://localhost:8080/geoserver/bochum_arbeitsbereich/wfs?service=WFS&version=1.1.0&request=DescribeFeatureType&typeName=bochum_arbeitsbereich%3Abochumtest11"

                    }),
                filter: filter0
    });

    //WfsLayer1
    var wfsLayer = new OpenLayers.Layer.Vector("Restaurants", {
        eventListeners:{
        'featureselected':function(evt){
            var feature = evt.feature;
            var popup = new OpenLayers.Popup.FramedCloud("popup",
                OpenLayers.LonLat.fromString(feature.geometry.toShortString()),
                null,
                '<div>Bezeichnung: '+feature.attributes.bez +'</div>',
                null,
                true
            );
            feature.popup = popup;
            map.addPopup(popup);
        },
        'featureunselected':function(evt){
            var feature = evt.feature;
            map.removePopup(feature.popup);
            feature.popup.destroy();
            feature.popup = null;
        }
        },
        strategies: [new OpenLayers.Strategy.BBOX()],
        styleMap: new OpenLayers.StyleMap({
                "default": new OpenLayers.Style(null, {rules: [rule]})}),
        protocol: new OpenLayers.Protocol.WFS({
                    url:  "http://localhost:8080/geoserver/wfs",
                    featureType: "bochumtest11",
                    featureNS: "bochum_namensraum",
                    featurePrefix: "bochum_arbeitsbereich",
                    geometryName: "the_geom",
                    srsName: "EPSG:900913",
                    version: "1.1.0",
                    schema: "http://localhost:8080/geoserver/bochum_arbeitsbereich/wfs?service=WFS&version=1.1.0&request=DescribeFeatureType&typeName=bochum_arbeitsbereich%3Abochumtest11"

                    }),
            filter : filter1
    });

   //WfsLayer2
   var wfsLayer1 = new OpenLayers.Layer.Vector("Museen", {
        eventListeners:{
        'featureselected':function(evt){
            var feature1 = evt.feature;
            var popup = new OpenLayers.Popup.FramedCloud("popup",
                OpenLayers.LonLat.fromString(feature1.geometry.toShortString()),
                null,
                '<div>Bezeichnung: '+feature1.attributes.bez +'</div>',
                null,
                true
            );
            feature1.popup = popup;
            map.addPopup(popup);
        },
        'featureunselected':function(evt){
            var feature1 = evt.feature;
            map.removePopup(feature1.popup);
            feature1.popup.destroy();
            feature1.popup = null;
        }
        },
        strategies: [new OpenLayers.Strategy.BBOX()],
        styleMap: new OpenLayers.StyleMap({
                "default": new OpenLayers.Style(null, {rules: [rule1]})}),
        protocol: new OpenLayers.Protocol.WFS({
                    url:  "http://localhost:8080/geoserver/wfs",
                    featureType: "bochumtest11",
                    featureNS: "bochum_namensraum",
                    featurePrefix: "bochum_arbeitsbereich",
                    geometryName: "the_geom",
                    srsName: "EPSG:900913",
                    version: "1.1.0"                    
            }),
            filter : filter2        
    });

    var selector = new OpenLayers.Control.SelectFeature(
        [wfsLayer, wfsLayerBasic, wfsLayer1],
        {
        hover:true,
        autoActivate:true
        }
        );


    map.addControl(selector);

(...)

share|improve this question
Firebug tells you something? Any error occures? – Odoakr Aug 26 '12 at 8:38

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.