<html><body><div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:10pt"><div><span>Work around for 1 can be found here.</span></div><div><span>http://www.mail-archive.com/openlayers-users@lists.osgeo.org/msg03169.html<br></span></div><div><br></div><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt;"><div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"><font face="Arial" size="2"><hr size="1"><b><span style="font-weight:bold;">From:</span></b> Gary Nobles &lt;garynobles@yahoo.com&gt;<br><b><span style="font-weight: bold;">To:</span></b> users@openlayers.org<br><b><span style="font-weight: bold;">Sent:</span></b> Wednesday, June 29, 2011 3:47 PM<br><b><span style="font-weight: bold;">Subject:</span></b> [OpenLayers-Users] Re: Popups appear on every click?<br></font><br>
Sorry tabs in my code:<br><br>My code is at the base of this post.<br><br>1) I am also having the problem where I have specified the layer to be<br>queried [settlements] but it still brings up a blank popup for a 'non<br>feature', I couldn't get this work around to work and i have been stuck on<br>this for days.<br><br>2) Also I am trying to get the hover to work so:<br>&nbsp; &nbsp;  a)you hover over a point and it shows<br>&nbsp; &nbsp;  b)you move outside of the popup up and it closes<br><br>Every method I find I can't get to work, any help is as always very much<br>welcomed.<br><br>Gary<br><br><br><br>var map;<br><br>&nbsp; &nbsp; &nbsp;  <br>function init(){<br>&nbsp; &nbsp; var bounds = new OpenLayers.Bounds(<br>&nbsp; &nbsp; &nbsp; &nbsp; 14000, 305900,<br>&nbsp; &nbsp; &nbsp; &nbsp; 277000, 610500<br>&nbsp; &nbsp; &nbsp; &nbsp; );<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //WSEN<br>&nbsp; &nbsp; var options = {<br>&nbsp; &nbsp;
 &nbsp; &nbsp; controls: [],<br>&nbsp; &nbsp; &nbsp; &nbsp; maxExtent: bounds,<br>&nbsp; &nbsp; &nbsp; &nbsp; maxResolution: 1219.2140625,<br>&nbsp; &nbsp; &nbsp; &nbsp; projection: "EPSG:28992",<br>&nbsp; &nbsp; &nbsp; &nbsp; units: 'm'<br>&nbsp; &nbsp; &nbsp; &nbsp; };<br><br>&nbsp; &nbsp; map = new OpenLayers.Map('map', {controls: [<br>&nbsp; &nbsp; &nbsp; &nbsp; new OpenLayers.Control.Navigation(),<br>&nbsp; &nbsp; &nbsp; &nbsp; new OpenLayers.Control.ArgParser(),<br>&nbsp; &nbsp; &nbsp; &nbsp; new OpenLayers.Control.Attribution(),<br>&nbsp; &nbsp; &nbsp; &nbsp; new OpenLayers.Control.OverviewMap()<br>&nbsp; &nbsp; &nbsp; &nbsp; ]<br>&nbsp; &nbsp; &nbsp; &nbsp; });<br><br>&nbsp; &nbsp; var overview = new OpenLayers.Control.OverviewMap({<br>&nbsp; &nbsp; &nbsp; &nbsp; size:new OpenLayers.Size(200,200),<br>&nbsp; &nbsp; &nbsp; &nbsp; projection: new OpenLayers.Projection("EPSG:28992"),<br>&nbsp; &nbsp; &nbsp; &nbsp; units: "m",<br>&nbsp; &nbsp; &nbsp;
 &nbsp; maxResolution: 610,<br>&nbsp; &nbsp; &nbsp; &nbsp; maxExtent: bounds,<br>&nbsp; &nbsp; &nbsp; &nbsp; restrictedExtent: bounds<br>&nbsp; &nbsp; &nbsp; &nbsp; });<br>&nbsp; &nbsp; &nbsp;  <br>&nbsp; &nbsp; //Base Layers<br>&nbsp; &nbsp; provincie_04 = new OpenLayers.Layer.WMS("Provinces",<br>"<a href="http://www.singlegrave.nl:8080/geoserver/wms" target="_blank">http://www.singlegrave.nl:8080/geoserver/wms</a>",<br>{layers:"provincie_04"},options);<br>&nbsp; &nbsp; Palaeo2750 = new OpenLayers.Layer.WMS("Palaeogeography 2750 BC",<br>"<a href="http://www.singlegrave.nl:8080/geoserver/wms" target="_blank">http://www.singlegrave.nl:8080/geoserver/wms</a>", {layers:"2750vc"},options);<br>&nbsp; &nbsp; Palaeo1500 = new OpenLayers.Layer.WMS("Palaeogeography 1500 BC",<br>"<a href="http://www.singlegrave.nl:8080/geoserver/wms" target="_blank">http://www.singlegrave.nl:8080/geoserver/wms</a>", {layers:"1500vc"},options);<br>&nbsp; &nbsp; Palaeo3850 = new
 OpenLayers.Layer.WMS("Palaeogeography 3850 BC",<br>"<a href="http://www.singlegrave.nl:8080/geoserver/wms" target="_blank">http://www.singlegrave.nl:8080/geoserver/wms</a>", {layers:"3850vc"},options);<br><br>&nbsp; &nbsp; //Data Layers<br>&nbsp; &nbsp; settlements = new OpenLayers.Layer.WMS("Settlements",<br>"<a href="http://www.singlegrave.nl:8080/geoserver/wms" target="_blank">http://www.singlegrave.nl:8080/geoserver/wms</a>",<br>{layers:"Neolithic_settlements",transparent:"true", format:<br>"image/png"},options,{isBaseLayer: false});<br>&nbsp; &nbsp; &nbsp;  <br>&nbsp; &nbsp; //add layers<br>&nbsp; &nbsp; map.addLayer(provincie_04);<br>&nbsp; &nbsp; map.addLayer(Palaeo1500);<br>&nbsp; &nbsp; map.addLayer(Palaeo2750);<br>&nbsp; &nbsp; map.addLayer(Palaeo3850);<br>&nbsp; &nbsp; map.addLayer(settlements);<br>&nbsp; &nbsp; &nbsp;  <br>&nbsp; &nbsp; //pop up feature<br>&nbsp; &nbsp; info = new OpenLayers.Control.WMSGetFeatureInfo({<br>&nbsp; &nbsp;
 &nbsp; &nbsp; layerUrls: [('<a href="http://www.singlegrave.nl:8080/geoserver/wms%27" target="_blank">http://www.singlegrave.nl:8080/geoserver/wms'</a>)],<br>&nbsp; &nbsp; &nbsp; &nbsp; title: 'Identify features by clicking',<br>&nbsp; &nbsp; &nbsp; &nbsp; layers: [settlements],<br>&nbsp; &nbsp; &nbsp; &nbsp; queryVisible: "true",<br>&nbsp; &nbsp; &nbsp;  <br>&nbsp; &nbsp; &nbsp; &nbsp; //hover: true,<br>&nbsp; &nbsp; &nbsp; &nbsp; //{'hover':{delay:500}},<br>&nbsp; &nbsp; &nbsp; &nbsp; eventListeners: {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; getfeatureinfo: function(event) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; map.addPopup(new OpenLayers.Popup.FramedCloud(<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "chicken",<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; map.getLonLatFromPixel(event.xy),<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
 null,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; event.text,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; null,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; true<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ));<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; &nbsp; &nbsp; });<br><br>&nbsp; &nbsp; map.addControl(info);<br>&nbsp; &nbsp; info.activate();<br>&nbsp; &nbsp; &nbsp;  <br>&nbsp; &nbsp;  // build up all controls<br>&nbsp; &nbsp; map.addControl(new OpenLayers.Control.PanZoomBar({<br>&nbsp; &nbsp; &nbsp; &nbsp; position: new OpenLayers.Pixel(2, 15)<br>&nbsp; &nbsp; &nbsp; &nbsp; }));<br>&nbsp; &nbsp; map.addControl(new OpenLayers.Control.Navigation());<br>&nbsp; &nbsp; map.addControl(new OpenLayers.Control.Scale($('scale')));<br>&nbsp; &nbsp; map.addControl(new
 OpenLayers.Control.MousePosition({element:<br>$('location')}));<br>&nbsp; &nbsp; map.addControl(new<br>OpenLayers.Control.LayerSwitcher({'div':OpenLayers.Util.getElement('layerswitcher')}));<br>&nbsp; &nbsp; map.addControl(new OpenLayers.Control.MousePosition());<br>&nbsp; &nbsp; map.addControl(overview);<br><br>&nbsp; &nbsp; //map.addControl(new OpenLayers.Control.MouseToolbar());<br>&nbsp; &nbsp; map.zoomToExtent(bounds);<br>&nbsp; &nbsp; //map.zoomToMaxExtent();&nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br>&nbsp; &nbsp; // wire up the option button<br>&nbsp; &nbsp; var options = document.getElementById("options");<br>&nbsp; &nbsp; options.onclick = toggleControlPanel;<br>}<br><br><br>--<br>View this message in context: http://osgeo-org.1803224.n2.nabble.com/Popups-appear-on-every-click-tp6247348p6530465.html<br>Sent from the OpenLayers Users mailing list archive at <a target="_blank"
 href="http://Nabble.com">Nabble.com</a>.<br>_______________________________________________<br>Users mailing list<br><a ymailto="mailto:Users@lists.osgeo.org" href="mailto:Users@lists.osgeo.org">Users@lists.osgeo.org</a><br>http://lists.osgeo.org/mailman/listinfo/openlayers-users<br><br><br></div></div></div></body></html>