I'm using ol3-cesium for creating 3D globe and cesium terrain provider to show terrain data on globe its working fine.

this.scene.terrainProvider = new Cesium.CesiumTerrainProvider({

url : "http://" + window.location.host + "/tilesets/world",

requestVertexNormals : true


But on click of a button i want to hide the terrain data or remove terrain provider from scene object, which ever is possible.


use the following function to toggle the terain

function toggleTerrain(){    
    var scene = ol3d.getCesiumScene();
    var terrainProvider;
    if (scene.terrainProvider._url){
        //add a simple terain so no terrain shall be preseneted
        terrainProvider = new Cesium.EllipsoidTerrainProvider({});
    else {
        //enable the terain
        terrainProvider = new Cesium.CesiumTerrainProvider({
            url : '//cesiumjs.org/stk-terrain/tilesets/world/tiles',
            requestWaterMask: true
    scene.terrainProvider = terrainProvider;

your key snippet is

terrainProvider = new Cesium.EllipsoidTerrainProvider({});
scene.terrainProvider = terrainProvider;
  • Is there any way to load terrain data of two places at same time?? – vinni May 5 '16 at 8:16
  • I am not sure but it doesnt sound logic. what if first terrain sais is 100m and second 50 meters. What would be the visual effect in that case? – pavlos May 5 '16 at 8:19
  • when i'm using above code snippet sometimes its loading my globe again and again in loop. – vinni May 5 '16 at 8:44
  • can you make a fiddle to demonstrate? – pavlos May 5 '16 at 8:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.