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