Hi all,
I am having some pretty fundamental issues figuring out how to work with CesiumJS. I can get the Cesium viewer up and running, and displaying a globe. I have even got it connecting to a local WMS server to display some image layers. Nice.
For the life of me though, I can't figure out to set the default location in the viewer? Is there an option that can be passed in to the viewer when it is initialised?
Failing that, I have tried using viewer.scene.camera.flyTo to go to the location I am interested in, but the function doesn't seem to exist. I get an 'undefined is not a function' error. Sure enough, if I step through it in a debugger, the function does not exist on the camera object.
Assuming the function existed, how would I trigger this when the scene is loaded? I can't find any evidence of an 'onload' function on viewer, scene, camera, or ImageryProvider. Should I just use the canvas.onload?
Code below. Note that I am using cesium 0.29.0, installed via Bower.
Thanks for your help!
Cheers,
Andrew
if (typeof Cesium=== ‘undefined’)
var Cesium = {};
var viewer = new Cesium.Viewer(‘cesiumHolder’, {
imageryProvider : new Cesium.WebMapServiceImageryProvider({
url : ‘http://localhost:9080/geoserver/gwc/service/wms’,
layers: ‘cite:Imagery’
}),
baseLayerPicker : false
});
setTimeout(function(){
viewer.scene.camera.flyTo({destination: Cesium.Cartesian3.fromDegrees(-110.7919, 38.4065, 15000)
})}, 5000); //Timeout as no onload function, want to make sure everything is rendered before triggering flyTo