maximumRequestsPerServer is ignored for sampleTerrain which causes failures in Chrome

Hi there,

I have noticed when sampling a large number of points that all of the requests are made simultaneously for the terrain tiles. This isn’t a problem in Firefox or Edge, but it causes Chrome to throw ERR_INSUFFICIENT_RESOURCES for any tiles over a certain number, so you get a lot of null height responses in Chrome when there are actually tiles there.

The maximumRequestsPerServer works correctly when just scrolling around the map.

Is it deliberate that it doesn’t work with sampleTerrain? Is there some way to enable it or control chunking?

Example of large number of simultaneous requests on sampleTerrain:

How many is too many requests? I wasn’t able to reproduce in this Sandcastle when you click “sample terrain at level 9” to sample terrain over a grid:

My best guess is sampleTerrain may not be accounting for this just because it isn’t a common use case. Can you describe more what you’re trying to do? If the scene you’re sampling is already loaded doing a series of globe.getHeight calls should be a lot more efficient:

We’re mapping the height of an area in high detail, so we’re talking sampling hundreds of thousands of points at a detail level of 15-16. This often results in many thousands of tiles being loaded. This isn’t using a Cesium Ion terrain server, but one in our local network, so the network side of things tends to be pretty quick even with this number of requests. I would love to use getHeight but then we have no control over the detail level of the tiles that are being used in the area we are sampling. It needs to be consistent.

I should specify that the reason we are sampling so many points at such high detail is for viewshed analysis. That’s also why it needs to be at a consistent detail level.

In case you haven’t seen it - we do have a viewshed tool as part of this commercial analytics SDK: You can reach out here to get an evaluation license.

Otherwise, it sounds like this operation could be faster if you just request all the tiles covering the area of interest at level 15-16, then just look up the heights in your grid. I’m actually not sure whether doing this with sampleTerrain will more or less behave that way if it’s caching tiles.

In any event, I think a contribution to have sampleTerrain obey the maximumRequests would be welcome. This is where requests currently get throttled:

I think you may need to change how sampleTerrain is making the request to go through the request scheduler, or otherwise apply that same logic there.

Hi Omar,

I have seen that you have the viewshed tool available and have tried reaching out through that link multiple times in the past (including right after you sent this reply). I have never received a response.

If I get time I will have a look at making that suggested change. Thanks.