Super, That works. And how can I register a changelayer listener on the map? I try this:
var options1 = { maxExtent: new OpenLayers.Bounds(662642.346412,152155.850000,726497.716088,206636.150000), maxResolution:'auto', numZoomLevels: '9', fractionalZoom: true, scales: [500000, 250000, 200000, 125000, 100000, 75000, 50000, 25000, 10000], units: 'm', projection: "EPSG:21781", controls: [] }; var map = new OpenLayers.Map('map',options1, eventListeners: { "changelayer": function(e) { if(e.property === "visibility") { alert("visibility changed (" + e.layer.name + ")"); } } } ); It doesn't work. Thank you for your help. Greetings Hanno Rahn ------------------------------------------ Hanno Rahn, Dipl.-Ing. (FH) Geoinformatik ZHAW Zürcher Hochschule für Angewandte Wissenschaften Umwelt und Natürliche Ressourcen Fachstelle Geoinformatik Grüental, Postfach CH-8820 Wädenswil Tel +41 (0)58 934 5592 Fax +41 (0)58 934 5580 hanno.r...@zhaw.ch www.iunr.zhaw.ch/geoinformatik -----Ursprüngliche Nachricht----- Von: Eric Lemoine [mailto:eric.lemo...@camptocamp.com] Gesendet: Donnerstag, 10. Juni 2010 13:47 An: Rahn Hanno (rahn) Cc: users@openlayers.org Betreff: Re: [OpenLayers-Users] OPENLAYERS LayerChange On Thu, Jun 10, 2010 at 1:40 PM, Rahn Hanno (rahn) <r...@zhaw.ch> wrote: > Hi, > > I try to make it, but it doesn't work. My layer looks like this: > > var zielrichtung = new OpenLayers.Layer.WMS("Zielrichtung",urlArray, > > {map:mapFile,layers:layerName,format:"image/png",EXCEPTIONS:"applicati > on/vnd.ogc.se_inimage"}, > {singleTile: true, ratio:1}, > "visibilitychanged": function() { > alert("visibility changed"); > } > ); > > zielrichtung.setIsBaseLayer(false); > map.addLayer(zielrichtung); > zielrichtung.setVisibility(false); > > var sld_zRichtung = url_ziel+"indikator="+indikator1; > zielrichtung.mergeNewParams({SLD:sld_zRichtung}); > > But it doesn't work. But where is my mistake. I don't know what to do now. > Please can somebody give me a tip? Try this: var zielrichtung = new OpenLayers.Layer.WMS("Zielrichtung",urlArray, {map:mapFile,layers:layerName,format:"image/png",EXCEPTIONS:"application/vnd.ogc.se_inimage"}, {singleTile: true, ratio:1, eventListeners: { "visibilitychanged": function() { alert("visibility changed"); } }}); -- Eric Lemoine Camptocamp France SAS Savoie Technolac, BP 352 73377 Le Bourget du Lac, Cedex Tel : 00 33 4 79 44 44 96 Mail : eric.lemo...@camptocamp.com http://www.camptocamp.com _______________________________________________ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users