try
info_hotspots.layers.push(layer_AOI_Hotspot);
info_hotspots.layers is an array.
/**
* Property: layers
* {Array(<OpenLayers.Layer.WMS>)} The layers to query for feature info.
* If omitted, all map WMS layers with a url that matches this <url>
or
* <layerUrls> will be considered.
*/
layers: null,
Arnd
-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Planet)x
Gesendet: Mittwoch, 12. Januar 2011 16:36
An: [email protected]
Betreff: [OpenLayers-Users] Can't add/remove layers from
WMSGetFeatureInfoControl
I am having a problem with this.. I need to do this because for some reason
after I add a certain amount of layers to the getfeatureinfo control the
response of it becomes slower (by about 5 seconds). So I am trying to
add/remove layers from the control based on if the user clicks the legend
entry to turn it on. My code is like the following -
var info_hotspots = new OpenLayers.Control.WMSGetFeatureInfo({
url: 'http://localhost/WebServices/Request.aspx',
title: 'hotspots',
queryVisible: false,
infoFormat: 'text/xml',
layers: [layer_Parcels_Hotspot],
maxFeatures: 1,
hover:false
});
//Areas of Interest
case 'Attraction':
if (checked == true)
{
info_aoi_attraction.activate();
attraction_show = true;
info_hotspots.layers += layer_AOI_Hotspot;
alert(info_hotspots.layers);
}
else if (checked == false)
{
info_aoi_attraction.deactivate();
attraction_show = false;
}
break;
And the alert message shows 2 layers now as Objects so the control obviously
has the 2 layers now. Except when I try to click on the layers now it does
not seem to respond anymore. Is there anyway to actually add/remove layers
so it works properly.. or is there something else I can do to speed up the
control? Thanks for any advice.
--
View this message in context:
http://osgeo-org.1803224.n2.nabble.com/Can-t-add-remove-layers-from-WMSGetFe
atureInfo-Control-tp5914965p5914965.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users