ArcGisImageServerTerrainProvider - failed to obtain tile

I am trying to get terrain data from our ArcGIS Server 10.1 (no proxy req'd) and combine it with our imagery.

I set it up using:
[code]
var esriTerrainProvider = new Cesium.ArcGisImageServerTerrainProvider({
    url: http://services.nconemap.com/arcgis/rest/services/Elevation/DEM20ft_ShadedRelief/ImageServer
    ,proxy : new Cesium.DefaultProxy('proxy.ashx')
    ,credit: 'Terrain data courtesy NC OneMap'
  });

var viewer = new Cesium.Viewer('cesiumContainer');
var scene = viewer.scene;
var centralBody = scene.getPrimitives().getCentralBody();
centralBody.depthTestAgainstTerrain = true;
centralBody.terrainProvider = esriTerrainProvider;
[/code]

I don't receive any errors other than: An error occurred in "ArcGisImageServerTerrainProvider": Cesium.js:82210
Failed to obtain terrain tile X: 1 Y: 0 Level: 0.

I can successfully get an image if I run use the export operation --http://services.nconemap.com/arcgis/rest/services/Elevation/DEM20ft_ShadedRelief/ImageServer/exportImage?bbox=406819.9999629706,34979.99992822111,3052479.9999629706,1043639.9999282211

I'm just getting started with this and realize that I may be reaching for straws but if I use the link above to test the export operation I then have to click on the "download image" link to actually get the image. When I look at the response in the proxy file I can see the html for this page as well. Is there something I need to do/configure to actually get the tiff? Any other ideas would be greatly appreciated. I'm a bit stumped. Thanks.

Brett

Hi Brett,

To use the ArcGisImageServerTerrainProvider, you need to use the ‘terrain’ proxy included with Cesium, or something similar. A general proxy won’t do the job.

ArcGIS Server can serve terrain rasters in a number of formats, including PNG and TIFF. TIFF works well in that it encodes each height as a floating point value. The problem is, web browsers (and, by extension, Cesium) cannot load TIFF files. Cesium can read PNG files, of course, but ArcGIS Server does not encode terrain in PNG files in a useful way. It effectively compresses the range of heights to fit in one byte (0-255) and then puts that compressed height value in each of the red-green-blue channels. This process loses too much precision to be useful for 3D visualization. The same is true of the other formats supported by ArcGIS Server, such as JPG.

To work around this, the Cesium terrain proxy requests tiles from ArcGIS Server in TIFF format, decodes the TIFF on the server, and re-encodes the image in a PNG file which is then sent to the client. The PNG file the terrain proxy creates, in contrast to the one ArcGIS creates itself, uses all three channels (red-green-blue) to represent a 24-bit integer. This approach allows much more precision in the heights.

So, you need to use the terrain transcoding proxy with ArcGIS Server. The source to that is in our GitHub repo if you need to port it to another environment. Alternatively, it may be possible to write a plug-in for ArcGIS Server that exports terrain data in another format, such as the one used by CesiumTerrainProvider (https://github.com/AnalyticalGraphicsInc/cesium/wiki/Cesium-Terrain-Server). I don’t know offhand what is involved in this, however.

Kevin

Ok, thanks Kevin. We just created a high-res DEM (20') for North Carolina and we've also got 6" imagery. We REALLY want to see what that looks like. I'll let yo u know how it goes. One final question, since our data is restricted to the extent of NC, will cesium still display the terrain?

I believe ArcGIS Server will fill the areas outside of where you have data with zeros, so you’ll just see the smooth ellipsoid outside of your area of interest.

Let me know how it goes and if I can help.

I’ve mentioned a few times now that we’re planning to (soon!) offer a terrain server that you can host on your own network, and that allows you to very easily incorporate your own terrain data from multiple sources and visualize it in Cesium. It will be a commercial product. Let me know if this is something you might be interested in.

Kevin