Hi, I’m displaying some vector poly lines on top of some images. The images seem to automatically get ‘clamped’ to the background ‘fromWorldTerrain’ ok. However, the vector data ‘flies’ above, and hence are offsetted from the image if the view is not ‘top down’. I have seen on different threads that one can set zIndex on the vector data as I have done here below, but it does not seem to change anything.
"
var vectorPromise = Cesium.GeoJsonDataSource.load(myGeoJsonObj,
{
stroke: randomColor,
fill: randomColor.withAlpha(0.5),
strokeWidth: 3,
zIndex: 1
})
.then(function (dataSource) {
viewer.dataSources.add(dataSource);
// Adjust the rendering order of entities based on zIndex
viewer.scene.groundPrimitives.raiseToTop(dataSource);
return dataSource;
})
.catch(function (err) {
console.error("Error loading GeoJSON: " + err.message);
});
vectorPromises.push(vectorPromise);
viewer.scene.globe.depthTestAgainstTerrain = false;
"
Anybody have an idea what I’m doing wrong?
For anybody else struggling with the same issue, when I removed the ‘terrain’ attribute from the Viewer object, the vector data clamped to the images.
"
var viewer = new Cesium.Viewer(viewerElement, {
shouldAnimate: true,
animation: false,
vrButton: true,
infoBox: true, // shows the layer name when double clicking on it
orderIndependentTranslucency: true,
selectionIndicator: true,
shadows: true,
timeline: false,
sceneModePicker: false,
baseLayerPicker: false,
projectionPicker: false,
geocoder: false,
navigationHelpButton: false,
//terrain: Cesium.Terrain.fromWorldTerrain(), //this made the vector data fly high above the images.
});
"