[OpenLayers-Users] Re: Popups appear on every click?

maw269 maw269 at gmail.com
Thu Apr 7 14:32:11 EDT 2011


Thanks Ravi,

I modified my code as such with the event.text.search:
// Begin: Add Popups with getFeatureInfo info :-)
				var maximumSize = new OpenLayers.Size(200, 200);
				
				var myPopupClass = new OpenLayers.Class
				(
					OpenLayers.Popup.FramedCloud,
					{
						'autoSize': true,
						'maxSize': new OpenLayers.Size(500,500)
					}		
				);				
				
				var info = new OpenLayers.Control.WMSGetFeatureInfo
				({
					url: 'http://domain/geoserver/wms', 
					layerUrls: [('http://domain/geoserver/gwc/service/wms')],
					layers: [PostCodes],							
					queryVisible: true,						
					eventListeners: 
					{							
						getfeatureinfo: function(event) 
						{									
							if (event.text.search("Type") != -1)							{									
								var myPopup = new myPopupClass
								(
									"chicken", 										
									map.getLonLatFromPixel(event.xy),
									null,
									event.text,
									null,
									true
								);
								map.addPopup(myPopup);								
							}								
						}
					}
				});
				map.addControl(info);
				info.activate();
				// End: Add Popup

This worked for me!
But you are right, it is not the best solution. I wonder what was causing
the issue in the first place??????

Matt

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Popups-appear-on-every-click-tp6247348p6251119.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list