Billboardcollection needs to add highreference: Cesium.HeightReference.CLAMP_ TO_ GROUND
Statement:
var viewer = new Cesium.Viewer("cesiumContainer", {
terrainProvider: new Cesium.EllipsoidTerrainProvider({}),
});
viewer.scene.globe.depthTestAgainstTerrain = true;
var billboardCollection = new Cesium.BillboardCollection({});
viewer.scene.primitives.add(billboardCollection);
billboardCollection.add({
image: "../images/facility.gif",
height: 20,
width: 20,
position: Cesium.Cartesian3.fromDegrees(77.273593, 38.191217),
scale: 3.0,
pixelOffset: new Cesium.Cartesian2(0.0, -20.0),
heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
});
In this case, an error will be reported:
Solution: scene: must be added viewer.scene
var billboardCollection = viewer.scene.primitives.add(
new Cesium.BillboardCollection({
scene: viewer.scene,
})
);
Read More:
- [Solved] Cannot read properties of undefined (reading ‘ajax‘); Cannot read property ‘ajax‘ of undefined
- Wechat program typeerror: a solution to cannot read property ‘SetData’ of undefined
- Can’t read property ‘push’ of undefined [How to Solve]
- [Solved] Parcel Package Error: Cannot read property ‘length‘ of undefined
- [Solved] Echarts Error: Cannot read property ‘init‘ of undefined
- [Solved] TypeError: Cannot read property ‘indexOf‘ of undefined at VueComponent.resetFields
- [Solved] Vue Error: Uncaught TypeError: Cannot read property ‘getters‘ of undefined
- [Solved] Vue + uniapp Uncaught TypeError: Cannot read property ‘getters‘ of undefined
- [Vue warn]: Error in render: TypeError: Cannot read property ‘xxxx’of undefined
- Vue error in render: “typeerror: cannot read property ‘length’ of undefined”
- [Solved] VUE Use Filters Error: [Vue warn]: Error in render: “TypeError: Cannot read property ‘toFixed’ of undefined”
- Uniapp: TypeError: Cannot read property ‘apply‘ of undefined (H5 does not report an error, but the real machine runs with an error)
- openlayers — Cannot read property ‘slice‘ of null—Map cannot be loaded
- [Solved] uview u-sticky Error: Cannot read property ‘bottom‘ of null
- El-cascader error: Cannot read property’level’ of null
- Vue Error in callback for immediate watcher “height”: “TypeError: Cannot read property ‘style’ of
- Vue ElementUI el-dropdown Error: Uncaught TypeError: Cannot read property ‘disabled‘ of null
- VUE Echarts Loading Error TypeError: Cannot read property getAttribute of null?
- [Solved] react18 swiper Error: Cannot read properties of undefined (reading ‘wrapperClass’)