[OpenLayers-Users] No Simple Popups on WFS features

Piero Campa piero.campa at gmail.com
Tue Mar 9 05:06:57 EST 2010


Hi everybody,
I'm a beginner to Openlayers and Javascripts. =)
I'm now at the stage "Try to open popups over WFS features" but I'm having
problems.

My template is the example in the Openlayers Documentation:
http://docs.openlayers.org/library/overlays.html#displaying-popups

but the problem is in the first instruction of the function
onFeatureSelect(evt):

function onFeatureSelect(evt) {
    feature = evt.feature;
    popup = new OpenLayers.Popup.FramedCloud("featurePopup",
                             feature.geometry.getBounds().getCenterLonLat(),
                             new OpenLayers.Size(100,100),
                             "<h2>"+feature.attributes.title + "</h2>" +
                             feature.attributes.description,
                             null, true, onPopupClose);
    feature.popup = popup;
    popup.feature = feature;
    map.addPopup(popup);
}

feature is undefined (because no evt.feature is found). 
I guessed I had to put evt.<the actual name of my feature> instead of
evt.feature, but still no feature gets defined. 
I analyzed the structure of evt object with Firebug but.. what a mess. 

(It's strange I get into the function ALWAYS, not just when my mouse is over
the feature, i.e. points on the map).

Thanks to all who read this, trying to help. 
Piero


-- 
View this message in context: http://n2.nabble.com/No-Simple-Popups-on-WFS-features-tp4701215p4701215.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.



More information about the Users mailing list