KMZ file.
bestpika opened this issue · 2 comments
bestpika commented
Could this plugin load kmz file?
tmcw commented
It cannot: this a combination of the fact that KMZ files are zip files and are difficult to process in browsers, and that they typically contain KML content with NetworkLinks, which are themselves not supportable.
pmusaraj commented
You could use a library like JSZIP (https://stuk.github.io/jszip/) to extract the contents of the KMZ file and then feed it to the map:
fetch(layer.content)
.then(function (response) {
if (response.status === 200 || response.status === 0) {
return Promise.resolve(response.blob());
} else {
return Promise.reject(new Error(response.statusText));
}
})
.then(JSZip.loadAsync)
.then(function (zip) {
return zip.file("doc.kml").async("string");
})
.then(function success(kml) {
overlayLayer = omnivore.kml.parse(kml);
overlayLayer.options = {interactive: false};
controls.addOverlay(overlayLayer, layer.name);
overlayLayer.addTo(map);
});