With ol 4.4.2 kml style with drag and drop is very difficult and I can't set it by the layer style. I can style it through the feature, but when I do, it's the style of the select interaction that does not work anymore. The extractStyle: false does not work anymore. Is there a bug ? How can I do it ?
dragAndDropInteraction.on('addfeatures', function(e) {
var vectorSource = new ol.source.Vector({
opacity: 1,
features: new ol.Collection(),
format: new ol.format.KML({
extractStyles: false, defaultStyle: AnnotImportStyle
}),
visible: true
});
var features = e.features;
//features.forEach (function(s){s.setStyle(AnnotImportStyle)}); it works but put the style of select out
vectorSource.addFeatures(features);
var file_name = e.file.name;
var name = file_name.substr(0, file_name.lastIndexOf('.'));
var vector = new ol.layer.Vector({
title: name,
source: vectorSource,
style: AnnotImportStyle,
visible: true,
});
map.addLayer(vector);
map.getView().fit(vectorSource.getExtent());
});