KMZ support in Cesium

204 views
Skip to first unread message

krake...@gmail.com

unread,
Nov 22, 2017, 12:33:49 PM11/22/17
to cesium-dev
1. A concise explanation of the problem you're experiencing.

I am trying to get this kmz file working in my version of Cesium (1.39) - "https://www.epa.gov/sites/production/files/2016-11/waters_data_1.8.kmz". It seems to load without error but does not function properly (i.e., like it does in Google Earth). When I zoom into a watershed boundary, it should update the map with the outlines of increasingly smaller subbasins. But it doesn't seem to refresh the views based on the network links for the data sources, and I can't figure it out based on my limited understanding of Cesium or find a CZML version.


2. A minimal code example. If you've found a bug, this helps us reproduce and repair it.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<meta name="description" content="A simple KML example.">
<meta name="cesium-sandcastle-labels" content="Showcases, DataSources">
<title>Cesium Demo</title>
<script type="text/javascript" src="../Sandcastle-header.js"></script>
<script type="text/javascript" src="../../../ThirdParty/requirejs-2.1.20/require.js"></script>
<script type="text/javascript">
require.config({
baseUrl : '../../../Source',
waitSeconds : 60
});
</script>
</head>

<body class="sandcastle-loading" data-sandcastle-bucket="bucket-requirejs.html">
<style>
@import url(../templates/bucket.css);
</style>
<div id="cesiumContainer" class="fullSize"></div>
<div id="loadingOverlay"><h1>Loading...</h1></div>
<div id="toolbar"></div>

<script id="cesium_sandcastle_script">
function startup(Cesium) {
'use strict';
//Sandcastle_Begin
var viewer = new Cesium.Viewer('cesiumContainer');
var options = {
camera : viewer.scene.camera,
canvas: viewer.scene.canvas,
};

Sandcastle.addToolbarMenu([{
text: 'KMZ - watersheds',
onselect: function () {
viewer.camera.flyHome(0);
viewer.dataSources.add(Cesium.KmlDataSource.load('../../SampleData/waters_data_1.8.kmz', options));

}
}], 'toolbar');

Sandcastle.reset = function() {
viewer.dataSources.removeAll();
viewer.clock.clockRange = Cesium.ClockRange.UNBOUNDED;
viewer.clock.clockStep = Cesium.ClockStep.SYSTEM_CLOCK;
};
//Sandcastle_End
Sandcastle.finishedLoading();
}
if (typeof Cesium !== "undefined") {
startup(Cesium);
} else if (typeof require === "function") {
require(["Cesium"], startup);
}
</script>
</body>

</html>


3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

Trying to build an interactive tool for modeling agricultural runoff.


4. The Cesium version you're using, your operating system and browser.

Cesium 1.39, CefSharp with NodeJS .

Gabby Getz

unread,
Nov 27, 2017, 4:33:06 PM11/27/17
to cesium-dev
Hi John,

I'm not too familiar with KML, but have you tried using the update function? It will refresh the network link. I think you may also need to subscribe to the refreshEvent.

Thanks,
Gabby



--
You received this message because you are subscribed to the Google Groups "cesium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cesium-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages