Re: [OpenLayers-Users] OPENLAYERS LayerChange
That's it. Thank you very much for your help. Greetings Hanno -- 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 14:12 An: Rahn Hanno (rahn) Cc: users@openlayers.org Betreff: Re: [OpenLayers-Users] OPENLAYERS LayerChange On Thu, Jun 10, 2010 at 2:04 PM, Rahn Hanno (rahn) wrote: > > 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.85,726497.716088,206636.150 > 000), > maxResolution:'auto', > numZoomLevels: '9', > fractionalZoom: true, > scales: [50, 25, 20, 125000, 10, 75000, > 5, 25000, 1], > 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. eventListeners must be set in the map options new OpenLayers.Map('map', { eventListeners: { "changelayer": function(e) { if(e.property === "visibility") { alert("visibility changed (" + e.layer.name + ")"); } } } }); -- 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
Re: [OpenLayers-Users] OPENLAYERS LayerChange
On Thu, Jun 10, 2010 at 2:04 PM, Rahn Hanno (rahn) wrote: > > 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.85,726497.716088,206636.15), > maxResolution:'auto', > numZoomLevels: '9', > fractionalZoom: true, > scales: [50, 25, 20, 125000, 10, 75000, 5, > 25000, 1], > 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. eventListeners must be set in the map options new OpenLayers.Map('map', { eventListeners: { "changelayer": function(e) { if(e.property === "visibility") { alert("visibility changed (" + e.layer.name + ")"); } } } }); -- 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
Re: [OpenLayers-Users] OPENLAYERS LayerChange
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.85,726497.716088,206636.15), maxResolution:'auto', numZoomLevels: '9', fractionalZoom: true, scales: [50, 25, 20, 125000, 10, 75000, 5, 25000, 1], 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) 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
Re: [OpenLayers-Users] OPENLAYERS LayerChange
On Thu, Jun 10, 2010 at 1:40 PM, Rahn Hanno (rahn) 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:"application/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
[OpenLayers-Users] OPENLAYERS LayerChange
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:"application/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? 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 ___ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users