Visualizing terrains with Cesium

Today we did some experiments to visualize terrains in Cesium, using Cesium Terrain Builder ( and Cesium Terrain Server (

Step 1] Get some raster data with height information

For this demonstration we use a raster file from the Dutch AHN2 in tif format with cells 0.5m X 0.5m, it can be obtained from  (500MB)

This image is about a part of Texel:


Step 2] Tile the raster with Cesium Terrain Builder

The original tif image is quite big (500MB) so we cut it into tiles using the  Cesium Terrain Builder. We use the tool ‘ctb-tile‘ for tiling inside a Docker container:

$ docker run -v  d:/gisdata/nederland/terrain:/data -ti -i homme/cesium-terrain-builder:latest bash

root@c1412e2fd51c:/# ctb-tile -o /data/tiles /data/i09bz1.tif


This takes some time to process (like 10 minutes), so grab a coffee and relax…

In the meantime binary .terrain files are generated for 20 zoom levels.


The terrain tiles are encoded in the so called ‘quantized-mesh-1.0 terrain format’, more info about this format at

Step 3: Run the Cesium Terrain Server

If all the tiles are generated we can start the Cesium Terrain Server. We use another Docker command for this:

$ docker run -p 8080:8000 -v d:/gisdata/nederland/terrain:/data/tilesets/terrain geodata/cesium-terrain-server


One tile we can retrieve from the server using a wget command:

wget http://localhost:8080/tilesets/tiles/0/0/0.terrain


Step 4: Visualize the terrain in Cesium

Cesium is a WebGL globe viewer that runs in a browser, see for more info.

All it takes now is to change in de basic Cesium viewer the index.html so it points to our local terrain server for getting the terrain tiles.


Put the Cesium viewer on a webserver (for example caddy , open a browser and zoomin to Texel.. If you change the perspective the terrain should become visible:



4 thoughts on “Visualizing terrains with Cesium

  1. Hi Bert, I find this tutorial is amazing since really few information about cesium. But I have a problem in the 4th step, the terrain not showed when running in the browser. I follow your step and use the same data. I used the wget too and its work fine, the terrain can retrieve. When I see in the Network (web developer tools in Mozilla), the terrain not loaded. Can you give me some solution for this problem? thank you.

      • Hi Bertt. I actually made stupid mistake in the script and finally the terrain showed up. Do you have an idea how to handle a big size data of DTM? I have data for a city that have high vertical resolution (~10 cm). I think It will caused a problem if I run the cesium terrain builder for nearly 100 gb data. Thank you in advance.

  2. great its working now! About the scaling up: we tiled the Netherlands with the terrain builder without a problem, took like 1-2 days and of course some disk space… Just try some smaller batches first and get an estimate how long it will take.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s