[OpenLayers-Users] dynamic adding wmc
Bart van den Eijnden
bartvde at boundlessgeo.com
Sun Oct 13 23:56:28 PDT 2013
Use layer.mergeNewParams({TRANSPARENT: true}); instead.
Best regards,
Bart
Bart van den Eijnden
Front-end Developer | Boundless
@boundlessgeo
On Oct 12, 2013, at 6:38 PM, Tim Balschmiter <tb.rostock at gmail.com> wrote:
> Hi List,
> i´ve generated a code to add wmc-layer as an Overlay to the map. My code use a file chooser for take a wmc-document. After loading the layers, i can see them on the map and i can see them in the switcher. But the transparency is inaktiv at the beginning, after zooming or dragging the map, the transparency works. How, can I change that is still working with loading the layers?
>
> Here is my examplecode:
> [code]
> $('.btn.addWMC').click(function(e)
> {
> var fileSelector = $('<input type="file" />').bind('change', function(e)
> {
> var file = this.files[0];
> var reader = new FileReader();
> reader.readAsBinaryString(file);
> reader.onloadend = function()
> {
> extrawmc = reader.result;
> extracontext = format.read(extrawmc,{map:map});
> for (var i=0; i<extracontext.layers.length;i++)
> {
> var layer = extracontext.layers[i];
> layer.params.TRANSPARENT = 'TRUE';
> }
> map.addLayers(extracontext.layers);
> }
> });
> var wmc = fileSelector.click();
> return false;
> });
> [/code]
> Thanks for helping me
> Tim
>
>
> _______________________________________________
> 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/20131014/0a6c642e/attachment.html>
More information about the Users
mailing list