var heightOffsetSouth = 5.1;
var tileset = viewer.scene.primitives.add(new Cesium.Cesium3DTileset({
url : '/3dmodel/SouthTiles/tileset.json',
maximumNumberOfLoadedTiles: 0,
maximumScreenSpaceError: 100
tileset.readyPromise.then(function() {
console.log('Loaded south tileset',tileset);
var boundingSphere = tileset.boundingSphere
var bounding = tileset._root._boundingVolume;
var center = bounding.boundingSphere.center;
var cart = Cesium.Ellipsoid.WGS84.cartesianToCartographic(center);
var dest = Cesium.Cartesian3.fromDegrees(
cart.longitude * (180 / Math.PI),
cart.latitude * (180 / Math.PI),
bounding._boundingSphere.radius * 20.2);
var cartographic = Cesium.Cartographic.fromCartesian(boundingSphere.center)
var surface = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, 0.0)
var offset = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, heightOffsetSouth)
var translation = Cesium.Cartesian3.subtract(offset, surface, new Cesium.Cartesian3())
tileset.modelMatrix = Cesium.Matrix4.fromTranslation(translation)
// viewer.camera.setView({ destination: dest });
}).otherwise(function(error) {
var tileset2 = viewer.scene.primitives.add(new Cesium.Cesium3DTileset({
url : '/3dmodel/NorthTiles/tileset.json',
maximumNumberOfLoadedTiles: 0,
maximumScreenSpaceError: 100
tileset2.readyPromise.then(function() {
console.log('Loaded north tileset');
var boundingSphere = tileset2.boundingSphere
var bounding = tileset2._root._boundingVolume;
var center = bounding.boundingSphere.center;
var cart = Cesium.Ellipsoid.WGS84.cartesianToCartographic(center);
var dest = Cesium.Cartesian3.fromDegrees(
cart.longitude * (180 / Math.PI),
cart.latitude * (180 / Math.PI),
bounding._boundingSphere.radius * 20.2);
var cartographic = Cesium.Cartographic.fromCartesian(boundingSphere.center)
var surface = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, 0.0)
var offset = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, heightOffset)
var translation = Cesium.Cartesian3.subtract(offset, surface, new Cesium.Cartesian3())
tileset2.modelMatrix = Cesium.Matrix4.fromTranslation(translation)
// viewer.camera.setView({ destination: dest });
}).otherwise(function(error) {