Skip to content

Instantly share code, notes, and snippets.

@theOgrable
Last active November 13, 2015 08:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theOgrable/0ab4af80958952cdd4ca to your computer and use it in GitHub Desktop.
Save theOgrable/0ab4af80958952cdd4ca to your computer and use it in GitHub Desktop.
Simple Cesium Sandcastle Example for KMZ bulk load
var viewer = new Cesium.Viewer('cesiumContainer');
function pushAIS (ds) {
ais.push(ds);
}
var ais = [];
function fetchKmzAIS(url) {
var index = 0;
var fileMax = 50;
while (index < fileMax) {
var rnd = Math.random(0,10000);
viewer.dataSources.add(Cesium.KmlDataSource.load(url + ".kmz?rnd=" + rnd)).then(pushAIS);
index ++;
}
}
function resetAIS() {
if (ais.length>0) {
viewer.dataSources.removeAll();
ais = [];
}
}
Sandcastle.addToolbarMenu([{
text : 'Empty'
},{
text : 'Reset',
onselect : function() {
resetAIS();
}
},{
text : 'KMZ - Bulk dowload',
onselect : function() {
fetchKmzAIS('http://theograble.github.io/AIS');
}
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment