Weird behavior with terrain, camera flyTo and many PointGraphics

I’m trying to display a large number (~6000) of entities with a PointGraphics instance attached. I’m seeing really weird behavior when using terrain (Cesium.createWorldTerrain) and HeightReference.CLAMP_TO_GROUND.
I create a CustomDataSource, add it to the viewers datasources collection, and add all the entities to it on application start. Then I let the camera fly to a position where all points should be visible. Once the camera motion ends, the points start moving around for about 30 seconds until they eventually settle in their designated positions. When disabling the terrain and Heightreference, all points display normally in their proper positions, only when using terrain does this weird behaviour occur. Is this a consequence of the way I add the points? How can I prevent this weird behavior?

It’s because the terrain comes in slowly in chunks, and points adjusts their position as a better terrain comes in. The terrain also comes in different accuracies depending on the speed of loading and what zoom level you’re at.

One thing you might try is to sample a central point with the sampleTerrainMostDetailed() first, that should hopefully, depending on the terrain data, speed the terrain to load the highest accuracy in that spot. You might even try to do this with a smattering of your points before plotting them, but there’s a balance as the sampling itself also has a performance hit.

I’ve got an open question about the same from last month, but using GeoJSON/KML where points do not adjust at all to incoming terrains. I think it’s because when parsing shape files someone decided not to monitor the incoming terrain positions as there’s a performance hit on lots of data doing this, but, no one has replied to that, so I honestly don’t know. Would be great to have an option to control it, though.



@Alexander_Johannesen thanks for your reply. At least I now know it’s a ‘known issue’, I thought I was going crazy initially.
Wouldn’t it be possible to ‘pre-load’ all terrain data (at least at a low-res level) to alleviate the issue?
Anyway, I’ll try your suggestion with sampleTerrainMostDetailed first.
best regards

Well, not so much pre-load, but there’s events you can subscribe to for when the Terrain is “ready” (to some definition of what it means to be ready), for example;

var terrainProvider = new Cesium.CesiumTerrainProvider({ url : ... })
terrainProvider.readyPromise.then( state => { 
   console.log('## terrain ready',state); 

I just wrote this code without testing it, but it’s something along those lines. Unfortunately, “ready for use” doesn’t mean the data is available, however the reason I showed you the above is that once the terrain is ready for use, you can use the terrainProvider’s loadTileDataAvailability(x, y, level) to make sure the terrain data for a certain spot is loaded. Of course, finding out how x and y correspond to the coordinate of your point is a different exercise. You can read more about those methods here;



Well, I’ve been experimenting a bit the past few days, but since the area covered by our application doesn’t have much terrain to begin with (The Netherlands are mostly flat) and since these issues don’t seem to have a magic button solution, we’re probably going to continue to work without terrain.