[OpenLayers-Users] dynamic adding wmc
Tim Balschmiter
tb.rostock at gmail.com
Sat Oct 12 09:38:19 PDT 2013
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20131012/9f84785a/attachment.html>
More information about the Users
mailing list