Last active
November 13, 2015 08:46
-
-
Save theOgrable/0ab4af80958952cdd4ca to your computer and use it in GitHub Desktop.
Simple Cesium Sandcastle Example for KMZ bulk load
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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