首页 / 浏览问题 / 三维GIS / 问题详情
webgl影像和地形加载失败
5EXP 2019年04月29日

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
    <title>尝试一下</title>


    <link href="./Build/Cesium/Widgets/widgets.css" rel="stylesheet">
    <link href="./css/widgets.css" rel="stylesheet">
    <!-- 有关球场景的样式都在这包含着,这个是必须引用的 -->
    <link href="./css/pretty.css" rel="stylesheet">

    <script src="./js/spectrum.js"></script>
    <script src="./js/jquery.min.js"></script>
    <script src="./js/config.js"></script>
    <script src="./js/bootstrap.min.js"></script>
    <script src="./js/bootstrap-select.min.js"></script>
    <script type="text/javascript" src="./js/require.min.js" data-main="js/main"></script>

</head>

<body>
    <div id="cesiumContainer" style="width:100%; height:100%"></div>
    <script type="text/javascript">
        var viewer;

        function onload(Cesium) {
            //  var viewer = new Cesium.Viewer('cesiumContainer');
            var viewer = new Cesium.Viewer('cesiumContainer', {
                terrainProvider: new Cesium.CesiumTerrainProvider({
                    url: 'http://localhost:8090/iserver/services/3D-yingxiang-gaocheng/rest/realspace/datas/DEM@GaoCheng%20and%20YingXiang',
                    requestWaterMask: true,
                    requestVertexNormals: true,
                    isSct: true
                })
            });


            var imagerlayers = viewer.imageryLayers;
            var imagerprovider = new Cesium.SuperMapImageryProvider({
                url: 'http://localhost:8090/iserver/services/3D-yingxiang-gaocheng/rest/realspace/datas/fsDOM@GaoCheng%20and%20YingXiang'
            });
            var layer = imagerlayers.addImageryProvider(imagerprovider);


            var scene = viewer.scene;
            var url = 'http://localhost:8090/iserver/services/3D-yingxiang-gaocheng/rest/realspace';
            var promise = scene.open(url);
            promsie.then(function(layers) {
                scene.camera.setView({
                    destination: Cesium.Cartesian3.fromDegrees(123.889957920147, 41.845761339203, 148.05688041728),
                    orientation: {
                        heading: 97.0931094600177,
                        pitch: -18.2783610386431,
                        roll: 4750
                    }
                });

            });

        }
    </script>


</body>

</html>

这段代码添加进去之后 影像和地形并未加载到webgl中这是为什呢?

1个回答

您在iserver的预览中可以看到该地形和影像吗?如果可以的话,建议用官网的的示例代码尝试
6,215EXP 2019年04月30日
大神想您提一个问题哈,为什么我利用viewer.pickEvent.addEventListener,单击效果对对我通过addEntity方法添加的entity不起作用呢?
...