I would like to know if there is how to load a kmz file, and then, to generate a kmldocument from this kmz file.
Solved! Go to Solution.
Hello,
I believe you could be able to do this.
sample code:
// load a KML dataset from a local KMZ file and show it as an operational layer
KmlDataset kmlDataset = new KmlDataset(kmz_data_path);
KmlLayer kmlLayer = new KmlLayer(kmlDataset);
SceneView.getScene().getOperationalLayers().add(kmlLayer);
// listen for the KML dataset to finish loading
// generate a kmldocument from this kmz file
kmlDataset.addDoneLoadingListener(() -> {
if (kmlDataset.getLoadStatus() == LoadStatus.LOADED) {
List<KmlNode> nodes = mKmlDataset.getRootNodes();
KmlNode rootNode = nodes.get(0);
assertTrue("Expected the root node to be a KmlDocument", (rootNode instanceof KmlDocument));
KmlDocument kmlDocument = (KmlDocument)rootNode;
}
The sample assumes the root node in the KMZ is a KMLDocument node.
Hello,
I believe you could be able to do this.
sample code:
// load a KML dataset from a local KMZ file and show it as an operational layer
KmlDataset kmlDataset = new KmlDataset(kmz_data_path);
KmlLayer kmlLayer = new KmlLayer(kmlDataset);
SceneView.getScene().getOperationalLayers().add(kmlLayer);
// listen for the KML dataset to finish loading
// generate a kmldocument from this kmz file
kmlDataset.addDoneLoadingListener(() -> {
if (kmlDataset.getLoadStatus() == LoadStatus.LOADED) {
List<KmlNode> nodes = mKmlDataset.getRootNodes();
KmlNode rootNode = nodes.get(0);
assertTrue("Expected the root node to be a KmlDocument", (rootNode instanceof KmlDocument));
KmlDocument kmlDocument = (KmlDocument)rootNode;
}
The sample assumes the root node in the KMZ is a KMLDocument node.
This suggestion works!!!