Ocean Adn Terrain/ TileMapServiceTerrainProvider

I am trying, using the branche OceanAndTerrain, use custom elevation data to visualize the globe.
I am using TileMapServiceTerrainProvider to acces mi data. This data is in a server and it was generated using the tool gdal2tiles with a custom elevation image.
The problem is that I always have an error when the TerrainProvider tries to retrieve an image from the server. Using firebug I have seen that the error is created on the file loadImage.js line 72. This function is called when the DOM object Image fails to load itself, but if I try to access this data with me web browser the url is correct and I can see the image.
I have had some similar error when I have tried to use the class WebMapServiceTerrainProvider.
Could you tell me if I am doing something wrong, or it is a bug?
Thanks in advance.


The terrainAndOcean branch is a work in progress and probably not really ready for use yet. Well, that’s true of the terrain branch, too, but terrainAndOcean is even more experimental.

The main problem you’re going to have is that ocean rendering requires a detailed map of where the land is versus where the water is. This information is currently (likely to change) stored in “.water” files stored alongside the “.terrain” files used by the CesiumTerrainProvider. The CesiumTerrainProvider downloads these water files as well and creates the necessary vertex data for water rendering. In other words, ocean rendering will not work at all with any terrain provider other than CesiumTerrainProvider.

The problem you’re having with TileMapServiceTerrainProvider is probably that you’re downloading the terrain data from a server other than the one that the main Cesium HTML page resides on. Even a different port counts as a different server. If that’s the case, the server must include so-called CORS headers in order for Cesium to be able to use the returned data. This is an unfortunate WebGL requirement. Enabling CORS is easy, though: http://enable-cors.org/

If you’re not able to enable CORS, the next best thing is to proxy all requests through the local server. Let me know if you need to do that and I’ll tell you how it’s done.


Thanks, I turned on the CORS support on my server and now it works correctly :wink: