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:

https://sandcastle.cesium.com/#c=tVjbbts4EP0Vbl4sow5l+e44LTZJs22wSVM0RoNF0wdaoiWiNOklKSfuIv++Q90syXKQYrF+iGVxLmeGhzPDbIhCj1LxYE6VIkygt+iCahavsK8oMfS+tOb88yAQfBT9O6ba3MOyuiH6xwkyKqadyuJXqgx9+iTVinCdCjyI5/bsQTyIDfjcMPpIFXgT9DH3+DV557T85OeFFAacUtXqoMyxSXF8VnLDAqpOKsgL866LNDWIszAyTITIyMx96hNrnwqKQy4XFFNBFpxe56JvE8mSlXiNCAe3ghi2oTkAtM4Q6DQYyjlba8mCHFk1rst8eV7F76R4UxtE+R+u7pJ0X3K6AX9SXJNt3dZZIjZnnO7E6mazbMWKn6BWZMxan7guzaX7AQZfIdPYlys3fXQVbJmrqdowSL5bRdF/72Ye4OlqRUJ6B4KwL0XG74gIfKINp5gEwVxKviDqhorY+Vbs3JNBgCa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Rfiy9mSEp72hNxhWtKt98UsemrNn9hjtxd3ZQ/6iUGHqzWtMNQiVgTcXWIjm2/dZrahv06K+haK+2wNbwbeVCl7IP6XyT5l8splW/KldrypWmh9IPKdq7VD8CDFBcJgS+/2EXOTsGHKMvHZ71mCzmQmZSQ3nNrI2hVT2YZsbzdh1yGqpPdUOUN4bnCKYToGhbulAX1zHOtr1k5LOc+XUKbhzKXF4cHxOh8vGG8d5bAyMtq1UC2UDZX6dQMSgayARR1O4Ue4Pwi+SpnS6u7jbLY5IlqPHiIp8PKsMX07zaN1BUM8ODGSdxvEtd7g3Lc+S20kr1UkzoFsvXMtqSbqRkKH3FG7acKOsp6wxT2yJnN+yWGEAhP4QHIgSkw2YJYukNbcrh+MR5kD5iKHNK+O0KgFbRAUgls6TOl6vgcvwwh5CE1GU3mhosHclb5W5lbKpVtd/YZ9fv9Fl1Ac3/X/f8QfRJH3UOTrVZsvpu9Ti72xls2n/QeDADGUoGIKotbuI/R/UYD91furmSqcB2yAWvH04qv1r5uEI+ZxoDSvLmHNbgx+O3p26IF9R45LYznwLoDjZWpHIe3edvsQYn7rwc1/LpIwF8crb3V2z0ddPKVdZVhrXK3krS2Tf/wI

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);

``