Closed bestpika closed 9 years ago
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.
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);
});
Could this plugin load kmz file?