Custom Terrain

Skip to first unread message

Richard Watson

Mar 17, 2015, 2:34:26 PM3/17/15
I am a Cesium newbie running on Windows 7 using the latest version of Chrome.  I can run
the Cesium examples without problems.

What I want to do is to display a custom image draped on a custom terrian which is built 
from a DEM.  In my case, the area of interest is typically on the order of a few km**2.

I loaded the Docker image for Cesium Terrain Builder and ran the ctb-tile utility on my DEM
image (which was a geotiff in a projected coordinate system).  This produced a set of tiled
terrain files.  I then added a layer.json file and a .htaccess file in the root directory 
which holds all the tile subdirectories (there were 22 levels).  I also went into level 0 
and added a 0.terrain file such that I have 0/0/0.terrain and 0/1/0.terrain.  Finally, I
used IIS to create a virtual directory so that the terrain can be accessed, and browsed,
via http.  It looks like this:


Where http://localhost/Terrains points to C:\Terrains.

Rather than using my custom image I chose to simply use the default image because I wanted to
focus on getting the terrain to work first.  I tried to use the Sandcastle as well as a copy 
of the viewer which I exposed out via IIS.

The terrain provider I used was:

    var terrainProvider = new CesiumTerrainProvider({

I can zoom on the globe to the location where the terrain is but the displayed image is very
flat so something is not working.  When I load my custom image and the DEM in ESRI ArcScene, 
it displays 3d very well and I am looking to achieve the same via the web.  BTW, I did not 
see any errors in the console.

I appreciate any help or guidance.

Richard Watson

Mar 17, 2015, 4:17:00 PM3/17/15
I misspoke when I said that I added an .htaccess file.  Since this is IIS, the file that I added is web.config:

<?xml version="1.0" encoding="UTF-8"?>
        <directoryBrowse enabled="true" />
            <add name="Access-Control-Allow-Origin" value="*" />
            <add name="Access-Control-Allow-Headers" value="Origin, X-Requested-With, Content-Type, Accept" />
          <mimeMap fileExtension=".terrain" mimeType="application/octet-stream"/>

Richard Watson

Mar 18, 2015, 1:48:44 PM3/18/15
I was able to make some progress on this and am sharing in case others have similar issues in the future.

One of the mistakes I made was to try and get the viewer running locally rather than using the sandcastle.  A better approach would have been to get it to work in sandcastle first.

Another issue is that I am using IIS/Windows and all the discussion is about Apache/LINUX.  Getting a web.config file running in IIS which was able to successfully expose a terrain took a bit of effort.

The last issue was simply digging through enough forum posts and reviewing the software.  One problem here is that the posts talk about the software at different points in time so sometimes it is hard to know what is and is not relevant with the current software.  Of course, one can always study the software itself but as a newbie that is a bit overwhelming when getting started.

What I have now is a terrain which covers a few km**2 displaying in the viewer.  The things that are odd are:
1) The image covered by the terrain (I am using the default image as I have not provided a custom image yet) is displayed floating well above the earth.
2) Around the boundary of the image there are long thin spikes which are displayed.  It looks like a multi-colored fence.
3) When the entire globe is displayed, the earth does not fill the circle.  It is depressed at the top with a large gap.

From reading posts, I think that what would be most desirable would be to have a terrain provider which uses the STK terrain for areas where I have not provided custom terrain.  My understanding is that way to do that is to develop a custom terrain server.

Kevin Ring

Mar 18, 2015, 7:09:49 PM3/18/15

Hi Richard,

The best way to do that is to use STK Terrain Server.  It will let you import the terrain for your small area and seamlessly blend it with the global terrain.

Here's a walkthrough of how it's done with STK Terrain Server:


You received this message because you are subscribed to the Google Groups "cesium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
For more options, visit

Richard Watson

Mar 20, 2015, 4:37:32 PM3/20/15
Thanks for that Kevin.  I will investigate STK Terrain Server.

Jan 22, 2016, 2:30:35 PM1/22/16
to cesium-dev
hello Richard, pls let me know how you have run cesium terrain builder command ctb-tile in window os.


Richard Watson

Jan 23, 2016, 6:36:31 AM1/23/16
to cesium-dev,
It has been quite a few months since I made the original posts and I have not looked at Cesium in quite some time.

Unfortunately, I have no notes (additional details) to share with you other than the posts above:(  As I mentioned above, I did use Docker on Windows in order to spin this up.
It would probably be easier to just use LINUX.

I was not able to sort out the problem of my terrain floating well above the earth.  The base terrain is provided by Cesium and I provided the detail terrain.  
When they don't match the system displays a multi-colored wall.  This problem is referred to in other posts as "cracking".

I have had a couple of thoughts recently.  One is whether or not the terrain has to be in meters.  It may be that mine was in feet.  
The other thought I had was to get the 4 corners (bounding box) of my detailed terrain and then get the same points on the Cesium terrain and then compute the average error.
Using the average error, try to correct my detailed terrain to better match the base terrain.
Message has been deleted

Mar 20, 2018, 2:54:32 PM3/20/18
to cesium-dev
hai Richard watson,

am a Cesium newbie running on can you help me how to display tiles in cesium.can you show me a step by step process

Gabby Getz

Mar 23, 2018, 2:53:54 PM3/23/18
to cesium-dev
Hi there,

You can use the Cesium World Terrain, or if you have your own terrain, you have to use something like the STK Terrain Server to serve the data.


Apr 8, 2020, 2:56:28 AM4/8/20
to cesium-dev
Hi Richard can you share the web.config file which allows serving .terrain files in IIS

Omar Shehata

May 4, 2020, 2:38:18 PM5/4/20
to cesium-dev
Heads up that the forum has transitioned over to Discourse and this Google Group will be put into read-only mode today. Details about the transition here.
Reply all
Reply to author
0 new messages