How to use sampleTerrain with many tiles?

I am using sampleTerrain to get data for analysis. Depending on the problem size/range and the terrain level, I can end up calling sampleTerrain with locations spanning thousands of tiles. This can result in net::ERR_INSUFFICIENT_RESOURCES errors for tile requests and undefined data for the corresponding tile requests.

In my experiments, I find that errors occur around the following:

  • With fresh page, errors occur if data exceeds 5500 tiles

  • Thereafter, errors occur if data exceeds 7500 tiles

I played with tileCacheSize but that does not seem to have an effect.

Has anyone else dealt with this issue or have advice?

As a work around, I am considering a paging type solution where I first calculate the number of tiles needed for the call, and break up the call if it exceeds that number. I can use code like what is inside sampleTerrain to calculate the number of tiles required for a request.

Thanks,

Jacob

Another work around is to sample at lower zoom levels so that fewer tiles are accessed.

I’m particularly interested if anyone else has ran into this and had to implement a check of the number of tiles required before calling sampleTerrain? Did you get similar numbers to mine above?

Jacob

Do you want the most detailed terrain sample, or at the level of tiles loaded? If the former, sampleTerrainMostDetailed might be a solution. If the later, what are you using the sampled height for? There may be another way to accomplish what you are trying to do using another part of the Cesium API.

Thanks,

Gabby

Hi Gabby,
My terrain data is global and medium resolution, so I am using sampleTerrain at the same fixed max zoom level as my Cesium map loads for visualization. If we enhance this in the future to use multi-resolution terrain data, sampleTerrainMostDetailed might be a good choice.

I need to create a contour map of data derived from the terrain data. So I generate a grid of locations, use sampleTerrain to get corresponding elevations, compute the gridded data from that, and then generate an image that is overlaid on the map.

If there is another part of the Cesium API that might apply, please let me know.

Thanks,
Jacob

Hi Jacob,

So you want to use the terrain data for the highest level you have available, right? I think sampleTerrainMostDetailed still covers this case, unless I am misunderstanding.

Otherwise, I think it may be more efficient to generate the height map imagery before loading it into Cesium.

Thanks,

Gabby