i am adding a layer to map , and upon zoomout removing the layer , the layer is removing but residues are coming , which are removed upon interaction with map , so i thought may be tilebuffering is issue but innvalidatesize is also not working
this is my code to do this :
$(function(){
map.on('zoomend', function (){
setTimeout(function(){
if (search_port_flag){
global_port_marker.fire('click')
search_port_flag=false
}
if (storm_labels)
{
for (let atcf_id in storm_labels)
{
if($(`.typhoons[atcf_id="${atcf_id}"]`).prop('checked'))
{
storm_labels[atcf_id]['labels'].forEach((label) =>{
if (map.getZoom() > 5)
{
map.addLayer(label)
}
else
{
map.removeLayer(label)
map.invalidateSize();
}
})
}
}
}
},500)
});
})