# How to create terrain files with txt DEM

**URL:** <https://community.cesium.com/t/how-to-create-terrain-files-with-txt-dem/9933>\
**Category:** CesiumJS\
**Created:** [June 18, 2020, 11:48am UTC](https://community.cesium.com/t/how-to-create-terrain-files-with-txt-dem/9933 "2020-06-18T11:48:54Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![sunwei](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/sunwei/32/1987_2.png) [@sunwei](https://community.cesium.com/u/sunwei)\
**Post date:** [June 18, 2020, 11:48am UTC](https://community.cesium.com/t/how-to-create-terrain-files-with-txt-dem/9933/1 "2020-06-18T11:48:54Z")

</div>

I want to create terrain files with a \*.txt file which has points like:

 ![Snipaste_2020-06-18_19-45-07](https://global.discourse-cdn.com/cesium/original/2X/4/4c11cc28d2de784a2df2feb357f9312d7c576c45.png). I’ve tried to use ArcMap to transform it to \*.tiif, but it can’t be tiled by Cesium Terrain Builder. So how can I show the points as terrain?

---

<div class="post-metadata">

**Author:** ![omar](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/omar/32/1999_2.png) [@omar](https://community.cesium.com/u/omar)\
**Post date:** [June 18, 2020, 6:57pm UTC](https://community.cesium.com/t/how-to-create-terrain-files-with-txt-dem/9933/2 "2020-06-18T18:57:44Z")

</div>

Have you tried uploading your GeoTIFF to Cesium ion ([https://cesium.com/ion/](https://cesium.com/ion/))?

---

<div class="post-metadata">

**Author:** ![sunwei](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/sunwei/32/1987_2.png) [@sunwei](https://community.cesium.com/u/sunwei)\
**Post date:** [June 19, 2020, 6:42am UTC](https://community.cesium.com/t/how-to-create-terrain-files-with-txt-dem/9933/3 "2020-06-19T06:42:28Z")

</div>

Yes, and Cesium Ion logged “Terrain raster must contain a single band of floating point or integer elevations”, but I’m not sure how to create this type of Geotiff with ArcGIS or other tools

---

<div class="post-metadata">

**Author:** ![omar](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/omar/32/1999_2.png) [@omar](https://community.cesium.com/u/omar)\
**Post date:** [June 19, 2020, 6:36pm UTC](https://community.cesium.com/t/how-to-create-terrain-files-with-txt-dem/9933/4 "2020-06-19T18:36:14Z")

</div>

What format is the original text file in? What do the coordinates there represent? It looks like some kind of X/Y and height? If the converter you’re using can’t output a TIFF with a single band, you may be able to post process it with GDAL. I’m assuming it’s outputting the elevation value as RGB.

Can you let me know the asset ID of your attempt on Cesium ion?

---

<div class="post-metadata">

**Author:** ![sunwei](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/sunwei/32/1987_2.png) [@sunwei](https://community.cesium.com/u/sunwei)\
**Post date:** [June 20, 2020, 2:38am UTC](https://community.cesium.com/t/how-to-create-terrain-files-with-txt-dem/9933/5 "2020-06-20T02:38:29Z")

</div>

115015 and 115018. They both showed “Terrain raster must contain a single band of floating point or integer elevations”,

---

<div class="post-metadata">

**Author:** ![omar](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/omar/32/1999_2.png) [@omar](https://community.cesium.com/u/omar)\
**Post date:** [June 22, 2020, 8:31pm UTC](https://community.cesium.com/t/how-to-create-terrain-files-with-txt-dem/9933/6 "2020-06-22T20:31:24Z")

</div>

Both of these assets are not single band images. The GeoTIFF you upload to Cesium ion has to be a single band (where the color represents the height).

What coordinate system is your source file in? You could try using QGIS or a command like suggested here with GDAL to generate the correct GeoTIFF: [https://gis.stackexchange.com/questions/227246/convert-huge-xyz-csv-to-geotiff](https://gis.stackexchange.com/questions/227246/convert-huge-xyz-csv-to-geotiff)

---

<div class="post-metadata">

**Author:** ![sunwei](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/sunwei/32/1987_2.png) [@sunwei](https://community.cesium.com/u/sunwei)\
**Post date:** [June 24, 2020, 9:01am UTC](https://community.cesium.com/t/how-to-create-terrain-files-with-txt-dem/9933/7 "2020-06-24T09:01:40Z")

</div>

The source file has no coordinate system, but I’ve create a new dem.tif with GDAL, but it still can’t work. Cesium Ion shows that “We’re having trouble with your data”, and the file’s asset ID is 116619.

---

<div class="post-metadata">

**Author:** ![omar](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/omar/32/1999_2.png) [@omar](https://community.cesium.com/u/omar)\
**Post date:** [July 7, 2020, 10:15pm UTC](https://community.cesium.com/t/how-to-create-terrain-files-with-txt-dem/9933/8 "2020-07-07T22:15:16Z")

</div>

That file is still invalid. It would help if you can share what software you’re using to view or export the source data. There must be a valid coordinate system for Cesium ion to place the terrain correctly on the globe.

---

<div class="post-metadata">

**Author:** ![sunwei](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/sunwei/32/1987_2.png) [@sunwei](https://community.cesium.com/u/sunwei)\
**Post date:** [July 10, 2020, 10:09am UTC](https://community.cesium.com/t/how-to-create-terrain-files-with-txt-dem/9933/9 "2020-07-10T10:09:35Z")

</div>

Thank’s a lot. I’ve solved this problem with the correct coordinate system.

---

<div class="post-metadata">

**Author:** ![sunwei](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/sunwei/32/1987_2.png) [@sunwei](https://community.cesium.com/u/sunwei)\
**Post date:** [July 10, 2020, 1:05pm UTC](https://community.cesium.com/t/how-to-create-terrain-files-with-txt-dem/9933/10 "2020-07-10T13:05:34Z")

</div>

By the way, Could I show my own terrain while the Cesium World Terrain is still visible? Or they just can’t work together?

---

<div class="post-metadata">

**Author:** ![omar](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/omar/32/1999_2.png) [@omar](https://community.cesium.com/u/omar)\
**Post date:** [July 10, 2020, 6:50pm UTC](https://community.cesium.com/t/how-to-create-terrain-files-with-txt-dem/9933/11 "2020-07-10T18:50:56Z")

</div>

Glad to hear you’ve resolved it!

> [@sunwei](#):
>
> Could I show my own terrain while the Cesium World Terrain is still visible?

Absolutely - when you upload your terrain, you’ll see an option to select a base layer. Select “Cesium World Terrain” as the base layer and this will merge your terrain on top. Let me know if that works for you.

---

<div class="post-metadata">

**Author:** ![sunwei](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/sunwei/32/1987_2.png) [@sunwei](https://community.cesium.com/u/sunwei)\
**Post date:** [July 11, 2020, 1:44am UTC](https://community.cesium.com/t/how-to-create-terrain-files-with-txt-dem/9933/12 "2020-07-11T01:44:56Z")

</div>

That works perfectly in Cesium Ion, but I want to achieve this function with my terrain from my own database instead of from Cesium Ion. Is that possible?

---

<div class="post-metadata">

**Author:** ![omar](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/omar/32/1999_2.png) [@omar](https://community.cesium.com/u/omar)\
**Post date:** [July 12, 2020, 11:02pm UTC](https://community.cesium.com/t/how-to-create-terrain-files-with-txt-dem/9933/13 "2020-07-12T23:02:10Z")

</div>

You’ll need to convert it to one of the terrain formats that CesiumJS supports (heightmaps or quantized mesh). Did you run into any issue with Cesium ion that prevents you from using it in your project?

---

<div class="post-metadata">

**Author:** ![sunwei](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/sunwei/32/1987_2.png) [@sunwei](https://community.cesium.com/u/sunwei)\
**Post date:** [July 13, 2020, 12:44am UTC](https://community.cesium.com/t/how-to-create-terrain-files-with-txt-dem/9933/14 "2020-07-13T00:44:38Z")

</div>

Thank 's for your suggestion, I will attempt to archive that. Cesium Ion is awesome, but some of our data are too many or mustn’t be uploaded to extranet, so I need to use our own database to manage them.
