Cesium Rest API + Unity

Hi!

I am trying to access cesium ion .terrain files from Unity via the rest API.
I uploaded a couple of geotiff files on my account so I have them as one asset.
Now in Unity I get the asset endpoint via the asset id to get the asset token.
Then I try to get the terrain file from “https://api.cesium.com/v1/assets/{AssetID}/{ZoomLevel}/{X}/{Y}.terrain”.
But the only response I get is Error 405 code:“MethodNotAllowed” message:“GET is not allowed”.
Also read that there should be a “https://api.cesium.com/v1/assets/{AssetID}/layer.json”, but I get the same response. I tested with my own asset and the cesium world asset “1”.

I pieced the process together from a couple of different sources but I am not sure if it is correct or if I am missing something.

Some help would be greatly appreciated!

Also in some references they talk about the .terrain files as if they are heightmaps, in others like they are meshes.
I guess they have been heightmaps in the past but are meshes now? or can I somehow choose which one I want?

1 Like

Ok, I used the wrong URL. I overlooked that the endpoints returns a URL as well.
The returned URL looks very similar on first glance so I dismissed it.
It should be something like “https://assets.cesium.com/{ID}”. Then the requests work, if you have the right ID and tile coordinates.

This helped a lot to the get the right coordinates:

The content type of the response should contain “application/vnd.quantized-mesh” if you want to check if a tile exists.