Entities on DEM Data

Hello Support,

Am facing a problem with DEM data and entities. Let me explain the problem.

  1. Am using offline globe(took sample from sandcastle demo) as a base globe in my project.

  2. I have created DEM tiles using cesium terrain builder . Am loading DEM tiles on top of offline globe in my project using this below script.

var ElevationProvider = new Cesium.CesiumTerrainProvider({
url: “http://localhost:8001/tilesets/DEM”,
requestVertexNormals: true,
ellipsoid: Cesium.Ellipsoid.WGS84

});
viewer.scene.terrainProvider = ElevationProvider;

  1. I have loaded some of the entities like bill board and polyline. But these entites are not in fixed position where I have loaded. Entities are moving along with the terrain .

Please see the below sreenshots.

  1. Original position of entities are shown in picture 1

  2. Once moved the terrain, entities are also moving along with the terrain. Shown in picture2

  3. Once tilt the terrain then entities are also going to under the terrain . Shown in picture3.

What is problem and where am doing wrong . Can somebody explain how to handle this.

Problem in loading DEM data or with lading entities?

Above scenario working properly with world terrain data with below code.

var viewer = new Cesium.Viewer(‘cesiumContainer’, {
terrainProvider: Cesium.createWorldTerrain()
});

But what is the problem with my DEM data.

Regards,

Tharak.

1 Like

How are you creating your entities? Are they set to be clamped to terrain?

Hi Omar,

Thank you for your support.

If I set clampToGround: true then the line is hugging the terrain and properly strict to terrain. This is good. Scrrenshot shown in figure 1. But my requirement is to show straight line on the terrain. I do not want to hug the line to terrain.

If I run the same sample(shown in below ) on sanccastle with world terrain then it is showing properly and screenshot show in figure 2. I want same output for my terrain also. Then where is problem on my terrain. Only the difference is am loading the DEM data separately .

var viewer = new Cesium.Viewer(‘cesiumContainer’, {
terrainProvider: Cesium.createWorldTerrain()
});

var lineOfSight = viewer.entities.add({
polyline : {
positions : Cesium.Cartesian3.fromDegreesArrayHeights([
77.8625, 31.9216, 5000.0,
78.0224, 31.9016, 5100
]),
width : 2,
material : new Cesium.PolylineOutlineMaterialProperty({
color : Cesium.Color.RED,
outlineWidth : 2,
outlineColor : Cesium.Color.RED
})
}
});

viewer.flyTo(lineOfSight);

did you set clampToGround: true when you load your DEM?

1 Like

@Tharak