[OpenLayers-Users] Popup problems on different GML layers with
GeoRSS format
Simo D
simone.dalmasso at gmail.com
Wed May 13 16:13:01 EDT 2009
Hi list, I'm trying to add custom popups on three GML layers which contains
GeoRSS feed.
My code is composed by three layers declarated like this.
var gdacs_earth = new OpenLayers.Layer.GML("Earthquakes (GDACS)",
"feedaddress", {format: georss_format, styleMap: createStyle('iconpath')});
Where georss_format is var georss_format = new
OpenLayers.Format.GeoRSS(in_options);
Then i attach three var eqpopups = new
OpenLayers.Control.SelectFeature(gdacs_earth, GeorssPopups.init());
map.addControl(eqpopups); eqpopups.activate();
obviously with different variable names.
GeorssPopups is a hash:
var GeorssPopups = {
init: function(){
return {onSelect: this.onFeatureSelect, onUnselect:
this.onFeatureUnselect};
} ,
onFeatureSelect: function(feature){
var 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,
function(){map.removePopup(feature.popup);
feature.popup.destroy();
feature.popup = null;});
feature.popup = popup;
map.addPopup(popup);
},
onFeatureUnselect: function(feature) {
if (feature.popup) {
map.removePopup(feature.popup);
feature.popup.destroy();
feature.popup = null;
}
}
};
The problem is that on most browsers this solution works only for the last
layer declarated except for Safari 4 where all works fine.
It seems that the listener associated with the SelectFeture method listens
only on the last GML layer declared. If I declare one layer with GML class
and others with the GeoRSS class it works. I also tried to declare two
layers from GML with only one having the selectFeature associated and it
breaks, I can see the icons but no frameCloud appears.
Can you help me? Having nice popups on GeoRSS it's important.
--
View this message in context: http://n2.nabble.com/Popup-problems-on-different-GML-layers-with-GeoRSS-format-tp2886288p2886288.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list