I had made a 3D view of the osm buildings using cesium. In which i had added a terrain effect using the standard cesium terrain provider as below
var viewer = new Cesium.Viewer('cesiumContainer'); var terrainProvider = new Cesium.CesiumTerrainProvider({ url : '//assets.agi.com/stk-terrain/world' }); viewer.terrainProvider = terrainProvider; var dataSource2 = new Cesium.GeoJsonDataSource(); var promise = dataSource2.load('../../SampleData/Hubli_Buildings.geojson'); promise.then(function(dataSource2) { viewer.dataSources.add(dataSource2); viewer.zoomTo(dataSource2); //Get the array of entities var entities2 = dataSource2.entities.values; var colorHash = {}; for (var i = 0; i < entities2.length; i++) { //For each entity, create a random color based on the state name. //Some states have multiple entities, so we store the color in a //hash so that we use the same color for the entire state. var entity = entities2[i]; var name = entity.Elev_in_m; var color = colorHash[name]; if (!color) { color = Cesium.Color.BROWN; colorHash[name] = color; } //Set the polygon material to our random color. entity.polygon.material = color; //Remove the outlines. entity.polygon.outline = false; //Extrude the polygon based on the state's population. Each entity //stores the properties for the GeoJSON feature it was created from //Since the population is a huge number, we divide by 50. entity.polygon.extrudedHeight = entity.properties.Elev_in_m; entity.polygon.height = entity.properties.Elev_in_m; } }).otherwise(function(error){ //Display any errrors encountered while loading. window.alert(error); }); After adding the terrain, my geojson 3D seems to be floated and shifted as below
I would like to know how to avoid this shifting effect after adding the terrain.
