Is it possible to set the style to hidden of certain parts of a layer of the map? The API documentation does not seems to have any property for it?
I tried to add the following:
var locatusObject = new ol.layer.Vector ({
source: locatusSource,
maxResolution: 14,
style: styleFunction
});
function styleFunction(feature,resolution) {
style = [new ol.style.Style({
stroke: changeStrokeStyle(),
fill: changeFillStyle(),
//opacity:0,
//visible:none
//visibility:hidden
})];
return style;
}
None seem to work?
EDIT
Oke, it seems to work when I set the variable "style=null"! But when I click a certain category, my map does not get reloaded?
I use the following code to click and reload my map:
$('#legend ul > li > ul > li').click(function(){
if($(this).attr('data-hidden')==='false'){console.log('in conditie'); $(this).attr('data-hidden', 'true');$(this).addClass('enabled');}
else {$(this).attr('data-hidden', 'false');$(this).removeClass('enabled');}
$('li').each(function(){
hiddenArray[$(this).attr('data-name')] = $(this).attr('data-hidden');
})
map.renderSync();
});
The map.renderSync() doesnt seem to do anything to my map?