Custom Terrain

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:

C:\Terrains\deepstep\0\0\0.terrain

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({

url: ‘http://localhost/Terrains/deepstep

});

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.

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"?>

<system.webServer>

</system.webServer>

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.

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:
https://assets.agi.com/stk-terrain/GettingStarted.html

Kevin

Thanks for that Kevin. I will investigate STK Terrain Server.

hello Richard, pls let me know how you have run cesium terrain builder command ctb-tile in window os.
thanks.

Piyush

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.

hai Richard watson,

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

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.

Thanks,

Gabby