Problems with CesiumTerrainProvider and heightmap-1.0 tiles

Hi I am new to Cesium and trying to display some height tiles using CesiumTerrainProvider.

**I am currently getting error. “Failed to obtain terrain tile X: 1 Y: 0 Level: 0.” (Pretty sure I have followed the rules etc) **

Further debugging shows the reason as

message: "Invalid typed array length: 4225"

stack: "RangeError: Invalid typed array length: 4225↵ at new Uint16Array ()↵ at createHeightmapTerrainData (http://localhost:8080/Build/CesiumUnminified/Cesium.js:38221:28)

Which I’ll take to mean my tiles are invalid format. Does anyone have some good example heightmap-1.0 demo tiles that I can server up for testing purposes. Or even a url I can point at.

**I’ve looked at sandcastle demos but I don’t see any good examples using **CesiumTerrainProvider. Thanks in advance.


My problem was due to a compression issue now fixed. However I have created some dummy tiles hoping to see some heights on the map but it always looks flat

I have only created tiles to a zoom level of 2. Does this matter I have zoomed in only two levels? or will it only be obvious at very high levels of zoom. Is there a way to check what height is used etc in the rendered view (ie get height from map function).

Also if I only want height detail at a very high levels of zoom does this mean I still have to have tiles above this level with their child flags set true?

Hey Alan,

How are you creating your terrain tiles? For getting height, check out these two functions:

Thank you Omar I will check out these functions. I am only just starting out so there is still a lot to read and learn about Cesium.
I have written my own TMS server (.net core) and currently just making up random .terrain files for testing purposes. I have image tiles already working OK, so now just need to master height tiles and then finally a quantizedmesh terrain.

Best of luck Alan!

If you haven’t already seen it, the Quantized Mesh spec is probably a good resource when you get there:

Dear Alan,
You wrote that your problem was due to compression issue.
Can you please elaborate?

You must have the wrong person. I have not used Cesium in over a year

1 Like

Thanks anyways.