[OpenLayers-Users] Popup only on WMS layer object

michsred michsred at gmail.com
Wed Aug 3 07:22:03 EDT 2011


Hi list,

is it possible to construct GetFeatureInfo machanism with popup which will
be active only on objects (points, lines, polygons) from WMS layers. I
already have popups working on my whole map. When I click outside of object
e.g polygon the opened popup is empty. I would like to have popups which
apear only on objects (or more precisely, only on places where
GetFeatureInfo information is present).

This is GetFeatureInfo code which I use:

info = new OpenLayers.Control.WMSGetFeatureInfo({
		url: 'http://webgis.24gis.pl/geoserver/wms', 
		title: 'Identify features by clicking',
		queryVisible: true,
		infoFormat: 'text/html',
		maxFeatures: 1,
		eventListeners: {
			getfeatureinfo: function(event) {
				popup = new OpenLayers.Popup.FramedCloud(
					"chicken", 
					map.getLonLatFromPixel(event.xy),
					null,
					event.text,
					null,
					true
				), {
					autoSize: false,
					maxSize: new OpenLayers.Size(5,5)
				};
				map.addPopup(popup);
			}
		}
	});
	map.addControl(info);


Thank you in advance for any sugestion!

Michal

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Popup-only-on-WMS-layer-object-tp6648352p6648352.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list