Cesium.sampleTerrain does not work at all with ArcGISTiledElevationTerrainProvider

1. A concise explanation of the problem you’re experiencing.

I’ve noticed that there are already multiple reports of the poor performance of the ArcGISTiledElevationTerrainProvider, and for me it is almost unusable when you zoom in close to the terrain - whereas I get a solid 60fps using Cesium World Terrain.

This post isn’t about that though, it’s about the fact that Cesium.sampleTerrain doesn’t seem to work at all with the ArcGISTiledElevationTerrainProvider.

2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.

  1. Please open the sandcastle link below

  2. Please click ‘Sample Everest Terrain at Level 9’. It will work fine using the default Cesium Terrain Provider or the Ellipsoid terrain provider.

  3. Use the dropdown to change the terrain provider to the ‘ArcGISWorldElevationLayer’. You’ll notice that the terrain does load and appear to work (albeit slowly).

  4. Click ‘Sample Everest Terrain at Level 9’ again, and it will crash.

Sandcastle Example

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

I need to be able to sample heights on the ArcGIS layer as it is the only terrain I have for my customer.

4. The Cesium version you’re using, your operating system and browser.

Cesium 1.65.0. Mac OS 10.15.2, Chrome 79.0.3945.117

Simpler example here:

Thanks for reporting this. Looks like this is a known issue. I have a bug report for this here with a bit of debugging info on what may be causing the issue:

https://github.com/AnalyticalGraphicsInc/cesium/issues/8007

That issue mentions sampleTerrainMostDetailed. I can’t get it working with normal sampleTerrain either.

I believe this is likely to be the same root cause. The only reason that Sandcastle crashes is because the error isn’t properly handled. You can see that the sampleTerrain call returns NaN height if you give it in an otherwise:

Cesium.sampleTerrain(viewer.terrainProvider, 9, terrainSamplePositions)

.then(function(result){ console.log(result); }).otherwise(console.error);

``