首页 / 浏览问题 / 三维GIS / 问题详情
倾斜摄影与Billboard贴地冲突
20EXP 2023年04月28日
当用Cesium3DTileset加载倾斜摄影 同时绘制一个Billboard 并将heightReference属性设置为Cesium.HeightReference.CLAMP_TO_GROUND时 放大地图到一定程度 和出现报错信息怎么处理

1个回答

您好,

具体出现的报错信息是什么呢?方便截图吗?

另外:billboard贴地示范代码
 

var viewer = new Cesium.Viewer('cesiumContainer',{
        //添加STK World Terrain地形服务
        terrainProvider : new Cesium.CesiumTerrainProvider({
            url : URL_CONFIG.STK,
            requestWaterMask : true,
            requestVertexNormals : true
        }),
        //添加BingMaps影像服务
        imageryProvider :  new Cesium.BingMapsImageryProvider({
            url : 'https://dev.virtualearth.net',
            mapStyle : Cesium.BingMapsStyle.AERIAL,
            key : URL_CONFIG.BING_MAP_KEY
        })
    });
    //设置相机视角
    viewer.entities.add({
        position : Cesium.Cartesian3.fromDegrees(103.064734, 31.12816),
        billboard :{
            image : './images/省级.png',
            heightReference:Cesium.HeightReference.CLAMP_TO_GROUND
        }
    });
    viewer.scene.globe.depthTestAgainstTerrain = false;
    viewer.scene.camera.setView({
        destination : new Cesium.Cartesian3.fromDegrees(103.064734,31.12816,8870.867706),
        orientation : {
            heading : 0.34555839949062594,
            pitch : -0.1422794351856307,
            roll : 0.0009471063581933947
        }
    });

可以对照一下

4,151EXP 2023年04月28日
//加载倾斜摄影

let tileset = new Cesium.Cesium3DTileset({

        url: 'xxxxxxx',

      });

      viewer.scene.primitives.add(tileset);

//绘制billboards

var billboards = new Cesium.BillboardCollection({

          scene:viewer.scene

        });

        billboards.add({

          image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAYAAACOEfKtAAAAAXNSR0IArs4c6QAACL9JREFUeF7lnH+sHFUVx79nd2e2P6ghWqV57c4WCm9meYbSpkkbyx9tgpE2CkpQFI0ShWALFC2gFkRQfghSauXHK6BEjfiLiE00SECQRotSY0CxdXdfa8vMPsqPIgm1tN27u3PMzHs1T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H8qX0pJXqvoAHVmOqdQqT6hGioWwDGI5k0E3KiaQDf9ZDYL2uUXG2D4KSVv3gDGN9oF66nfM252KuJrcXPSAjDsiTnzOiLcGjehTvgz4baCK67XEUsbwLAnWuaXAbS8oqsj6TgaBNxue2JDHI2JvloBBsIj+ew1PvOduhLUrHOn4wmtb5pqBzg2nJO9KaAClYk3Fdya9m8USQTg2HDOXgXwZpVidfukwJsHvVoiN/sTAzi+2L6CmVu+qKIb1v/rEfge26utSypOogDDnpgz1oBoOKkCWuoSDTsKr/FHyTVxgOGcaBmXEUjLTSzZ4hj0QMGrfl7WXtWuIwDDp7NlXOZ3DCI94HQAXlBXxwB2bDgTbXHcavB9hR1pHQU4/mC5nJnvTaI6Yr7PrtSuSEK7mWbHAY7NidkrCXy3zkKDP0qhUrtSp6aMVlcAjs2J2XU++DsySba34bsdrxbcmel46xrAcE60sl8AuOnVMTkavNlJaJEsE7+rAMM5MZddz4oXxIl4k53AxzMZcMdsug4wnBPz2Wso6gYEY6NTEddGKTYJ254AODaczWCXJPheLpn2LccTwdZZ11vPAByHKLOfqO0lRR30ewpgOCda5gYGbpusOAa+WfDEdToK16XRcwDDnpgzrwfhlv8pUuGr6XRBaqXTkwBDiBMPqjQdACUBtGcBhk9ny7wxBZDd5p5yEmBkNf8DAJfSb12ZBEAAAAAASUVORK5CYII=',

          heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,

          // heightReference: Cesium.HeightReference.NONE ,

          //disableDepthTestDistance: Number.POSITIVE_INFINITY,

          //disableDepthTestDistance:0,

          horizontalOrigin: Cesium.HorizontalOrigin.CENTER,

          verticalOrigin: Cesium.VerticalOrigin.BOTTOM,

          // pixelOffset: this.offset ? new Cesium.Cartesian2(this.offset[0], this.offset[1]) :new Cesium.Cartesian2(0, 0),

          width: 24,

          height: 22,

          scale: 1,

          position : Cesium.Cartesian3.fromDegrees(120.3729791,27.862445,0),

        })

 

        var collection = new Cesium.PrimitiveCollection();

        collection.add(billboards);

        viewer.scene.primitives.add(collection);
所以您的报错信息是什么呢?方便截图吗?

这个是报错信息

image

image

从报错来看,tilesetPassState应该是一个函数,且类型的设置出现了问题,您看一下这个函数是否有问题。

可以参考https://blog.csdn.net/weixin_45782925/article/details/124020377里的问题,应该是一类问题。

...