[OpenLayers-Users] light-basic popup

Smaran Harihar smaran.harihar at gmail.com
Thu Jun 7 13:37:38 PDT 2012


Hi,

I am trying to replicate this
example<http://openlayers.org/dev/examples/light-basic.html>,
but I am not able to get the PopUp for my OL. Any Idea what I am missing?

Here is the code,

var QuebecSpecies = new OpenLayers.Layer.Vector("AllQuebecSpecies", {
strategies : [new OpenLayers.Strategy.Fixed()],
 projection : new OpenLayers.Projection("EPSG:4326"),
visibility : true,
 protocol : new OpenLayers.Protocol.WFS({
version : "1.1.0",
 url : "http://niles.iplantcollaborative.org:8080/geoserver/wfs",
 featurePrefix : 'iPlant', //geoserver worspace name
featureType : "AllQuebecSpecies", //geoserver Layer Name
 featureNS : "http://geoserver-iPlant", // Edit Workspace Namespace URI
geometryName : "the_geom" // field in Feature Type details with type
"Geometry"
 })
  });

map.addLayers([QuebecSpecies]);

var vector = new OpenLayers.Layer.Vector("VecPopInfo",{
 eventListners:{
'featureselected' :function(event) {
var feature = event.feature;
 var popup = new OpenLayers.Popup.FramedCloud("popInfo",
map.getLonLatFromPixel(event.xy), null, "<div
style='font-size:.8em'>Family: " + feature.attributes.Family +"<br>Species:
" + feature.attributes.Species +"</div>", null, true);
 feature.popup = popup;
map.addPopup(popup);
 },
'featureunselected':function(event){
var feature = event.feature;
 map.removePopup(feature.popup);
feature.popup.destroy();
feature.popup = null;
 }
}
});
 vector.addFeatures(QuebecSpecies);
var selector = new OpenLayers.Control.SelectFeature(vector, {
 //clickout : true
hover:true,
autoActivate:true
 });
 map.addLayers([vector]);
 map.addControl(selector);




-- 
Thanks & Regards
Smaran Harihar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20120607/a0a83f7f/attachment.html>


More information about the Users mailing list