Use sampleTerrain() or sampleTerrainMostDetailed() with C# .NET

Hello,

I need to store the results of sampleTerrain() in a file.

Currently, I can only execute this function with JavaScript whereas all of the supporting code I have is in C# .NET.

Is it possible to query this function outside of JavaScript?

Thanks,
Nick

There does exist an ion REST API but we’re currently working on documenting it. In the mean time, you could go in the network tab of your CesiumJS application, find the request it’s making, and then make that request yourself with your asset token in C#. The request URL will look something like:

https://assets.cesium.com/1/11/1207/1489.terrain?extensions=metadata&v=1.2.0

``

Where the first 1 is the asset ID (which is Cesium World Terrain in this case), and then I believe it’s followed by level, x and y.

Do note that downloading content from ion for offline use may be against the terms of service:

But as long as you’re requesting it on every session/use then that should be fine.