首页 / 浏览问题 / 三维GIS / 问题详情
iclient for cesium使用new Cesium.SuperMapImageryProvider 报that 错误
5EXP 2025年07月08日

我使用iclient for cesium  2025,  在vue3中,把解压出来的 cesium 目录 放到了public 下,想加载这个地图服务:

http://10.55.69.155:8885/gtis/data/rest/33254950eab64884a374823d05eef48f
使用的代码:

const bianjieUrl = 'http://10.55.69.155:8885/gtis/data/rest/33254950eab64884a374823d05eef48f'
var filterLayer = new Cesium.SuperMapImageryProvider({
  url : bianjieUrl
})
var layer = viewer.imageryLayers.addImageryProvider(filterLayer);

console报错为:

Uncaught ReferenceError: that is not defined
    at new SuperMapImageryProvider (Cesium.js:27491:3735)
    at Proxy.select2 (HelloWorld.vue?t=1751943111387:85:27)
    at _createElementVNode.onClick._cache.<computed>._cache.<computed> (HelloWorld.vue?t=1751943111387:369:67)
    at callWithErrorHandling (runtime-core.esm-bundler.js:199:19)
    at callWithAsyncErrorHandling (runtime-core.esm-bundler.js:206:17)
    at HTMLInputElement.invoker (runtime-dom.esm-bundler.js:729:5)

开发环境无问题,前面已经使用功能加载影像如

Cesium.Credential.CREDENTIAL = new Cesium.Credential(
    "8ab730c89-----60601d402ad",
    "token");
viewer = new Cesium.Viewer('cesiumContainer', {
  scene3DOnly: false, //每个几何实例将只能以3D渲染以节省GPU内存
  sceneMode: 3, //初始场景模式 1 2D模式 2 2D循环模式 3 3D模式
});

var labelImagery = new Cesium.TiandituImageryProvider({
  mapStyle: Cesium.TiandituMapsStyle.CIA_C,
  token: '1f74731b----3c04e44db0d47c'
});
viewer.imageryLayers.addImageryProvider(labelImagery);

如何解决,谢谢

1个回答

您好,根据您的描述,是打包过程出了问题?请补充下node版本呢,还有iClient for Cesium的具体版本,最好也能提供一下。
1,345EXP 2025年07月08日

iclient for cesium 2025版本。不是打包过程的问题,是跑这段代码的问题。

另请教:

var promise=scene.addS3MTilesLayerByScp(
    "http://10.55.69.155:8885/gtis/3d/s3m/66c7b6c59ae4470aabbad03793e44e69/rest/realspace/datas/xx_bm/config",
    {name:"xx_bm",cullEnabled:false});
Cesium.when(promise,function (layer) {
  viewer.zoomTo(layer);
})

addS3MTilesLayerByScp 为Cesium-es6.d.ts中的方法,

加载后图面空白,没有加载出来使用postman之类工具查询url 中的内容为另附文件 

加载代码是否正确

{

    "asset": "SuperMap",

    "compressedPackageType": "Zip",

    "crs": "epsg:4326",

    "dataType": "Vector",

    "extensions": {

        "attachFiles": [],

        "levels": [],

        "pointCloudLayers": [],

        "s3m:AttributeExtentName": "s3md",

        "s3m:FileType": "OSGBCacheFile",

        "s3m:ProcessType": "Normal",

        "s3m:TileSplitType": "GLOBAL",

        "scales": [

            {

                "caption": "144447",

                "tilewidth": "9783.94",

                "value": "0.000006922909989284475"

            }

        ],

        "vol": []

    },

    "geoBounds": {

        "bottom": 30.41742325894123,

        "left": 111.1753821900001,

        "right": 111.542076405,

        "top": 30.74773990314793

    },

    "heightRange": {

        "max": 0,

        "min": 0

    },

    "idFieldName": "",

    "lodType": "Replace",

    "position": {

        "units": "Degree",

        "x": 111.3587292975,

        "y": 30.58258158104458,

        "z": 0

    },

    "pyramidSplitType": "Unknown",

    "tiles": [

        {

            "boundingbox": {

                "max": {

                    "x": -17475.10753253991,

                    "y": 10397.13551270535,

                    "z": -11.99736785079307

                },

                "min": {

                    "x": -17554.26795098935,

                    "y": 10287.95988161968,

                    "z": -32.69624509432361

                }

            },

            "url": "./Tile_-0350_1264/Tile_-0350_1264.s3mb"

        },

        {

            "boundingbox": {

                "max": {

                    "x": -8761.144349287251,

                    "y": 17272.02108597816,

                    "z": 10.12123102462824

                },

                "min": {

                    "x": -16218.32337269766,

                    "y": 10289.98942899009,

                    "z": -44.43729779015759

                }

            },

            "url": "./Tile_-0350_1265/Tile_-0350_1265.s3mb"

        },

        {

            "boundingbox": {

                "max": {

                    "x": -1360.601196251696,

                    "y": 18388.00621407408,

                    "z": 80.9706653048676

                },

                "min": {

                    "x": -8348.231506068174,

                    "y": 10141.45359660615,

                    "z": -31.3807332774067

                }

            },

            "url": "./Tile_-0350_1266/Tile_-0350_1266.s3mb"

        },

        {

            "boundingbox": {

                "max": {

                    "x": 6962.782343785636,

                    "y": 10862.83922470951,

                    "z": 1.859482608026486

                },

                "min": {

                    "x": 423.1167712004067,

                    "y": 10295.08462256009,

                    "z": -13.77169785043452

                }

            },

            "url": "./Tile_-0350_1267/Tile_-0350_1267.s3mb"

        },

        {

            "boundingbox": {

                "max": {

                    "x": -8708.835731439991,

                    "y": 7464.337210033382,

                    "z": 3.857825660329148

                },

                "min": {

                    "x": -8884.304848034328,

                    "y": 7251.082754178597,

                    "z": -10.6278078839156

                }

            },

            "url": "./Tile_-0349_1265/Tile_-0349_1265.s3mb"

        },

        {

            "boundingbox": {

                "max": {

                    "x": -135.9379584138924,

                    "y": 10148.4993373444,

                    "z": 31.17778794244974

                },

                "min": {

                    "x": -4017.447260159131,

                    "y": 4165.222216479428,

                    "z": -10.01997435481174

                }

            },

            "url": "./Tile_-0349_1266/Tile_-0349_1266.s3mb"

        },

        {

            "boundingbox": {

                "max": {

                    "x": 7058.336315898459,

                    "y": 9684.739695387409,

                    "z": 24.28286517432077

                },

                "min": {

                    "x": -72.77741550374003,

                    "y": 2547.303257849908,

                    "z": -11.25091182597389

                }

            },

            "url": "./Tile_-0349_1267/Tile_-0349_1267.s3mb"

        },

        {

            "boundingbox": {

                "max": {

                    "x": 6874.582588293462,

                    "y": -3873.45657094598,

                    "z": 23.45484964904967

                },

                "min": {

                    "x": 5275.519773787839,

                    "y": -6606.28712603924,

                    "z": -6.933397978771644

                }

            },

            "url": "./Tile_-0348_1267/Tile_-0348_1267.s3mb"

        },

        {

            "boundingbox": {

                "max": {

                    "x": 9788.941284296478,

                    "y": -2711.526174141889,

                    "z": 3.940933602821346

                },

                "min": {

                    "x": 9739.022344484945,

                    "y": -2902.329333056683,

                    "z": -8.243411240575025

                }

            },

            "url": "./Tile_-0348_1268/Tile_-0348_1268.s3mb"

        },

        {

            "boundingbox": {

                "max": {

                    "x": 15476.78779222475,

                    "y": -16763.96949278917,

                    "z": -18.92621555846841

                },

                "min": {

                    "x": 14098.73795651352,

                    "y": -17917.1062385222,

                    "z": -43.47878708884249

                }

            },

            "url": "./Tile_-0347_1268/Tile_-0347_1268.s3mb"

        },

        {

            "boundingbox": {

                "max": {

                    "x": 17600.85217912553,

                    "y": -18294.36729425323,

                    "z": -39.23375234452988

                },

                "min": {

                    "x": 17477.98375691626,

                    "y": -18371.21093816694,

                    "z": -50.73736405547754

                }

            },

            "url": "./Tile_-0347_1269/Tile_-0347_1269.s3mb"

        }

    ],

    "version": "2.0",

    "wDescript": {

        "category": "",

        "range": {

            "max": 0,

            "min": 0

        }

    }

}
...