Understanding Cesium heightmap terrain data

592 views
Skip to first unread message

Jacob

unread,
Jun 22, 2017, 2:19:04 PM6/22/17
to cesium-dev
I've studied the heightmap terrain spec and I think I have a grasp of it. However, I'd appreciate if someone could confirm my understandings:

1. The binary data format for heights is unsigned int16 (as opposed to signed int16), so that the possible range of terrain heights that can be represented is -1000 m to 12107 m. The upper bound is computed from 65535/5 - 1000.

2. A terrain file contains data for 65x65 points, starting in NorthWest corner and tracing values East. The data points correspond to a regular grid over the lat/lon limits of the tile with regular lat/lon spacing between data points. As an example, file 1/0/0.terrain defines terrain for the range -180 to -90 longitude and -90 to 0 latitude. That means that the first value in the terrain file corresponds to longitude -180 and latitude 0. The spacing between data points in degrees would then be 90/(65-1)=1.4063, so that the second data point would represent longitude -178.5937 and latitude 0, since it is directly East of the first point by the spacing amount.

3. If someone had terrain files in a different format than .terrain, they could implement support for it in Cesium by writing a custom terrain provider. For example, if someone had the same TMS-style file folder layout but had a different format of file, it should be fairly straightforward to write a class implementing the TerrainProvider interface to support it.

Is that all right?

Thanks,
Jacob

Mark Erikson

unread,
Jun 22, 2017, 3:28:22 PM6/22/17
to cesium-dev
#1 should be correct, I think #2 is correct, and I'm not sure about #3.  What other terrain data do you have?  You may be better off using a tool like https://github.com/geo-data/cesium-terrain-builder to convert your other terrain data into heightmap format.

farouk abdou

unread,
Jun 22, 2017, 10:46:51 PM6/22/17
to cesium-dev
Hello,
an example for the point 3 is GeoserverTerrainProvider

Jacob

unread,
Jun 23, 2017, 9:34:59 AM6/23/17
to cesium-dev
Thanks Mark and farouk!

On 3, I don't have a different terrain format now but am assessing whether this could be supported, since it is a possibility in the future.

Jacob
Reply all
Reply to author
Forward
0 new messages