首页 / 浏览问题 / WebGIS / 问题详情
mvt服务加载报错
1EXP 2025年08月26日
使用产品:iclient for webgl supermapversion:39571操作系统:windows x64 按照MVT范例中加载mvt服务,报以下错误:TypeError: Cannot read properties of undefined (reading 'version') at _0x4ae6a8.serialize (SuperMap3D.js:1:4080205) at i$O.get (SuperMap3D.js:1:4254055) at Proxy.addMap (MVT.vue:76:34) 服务能加载到球上。但是报错,执行不了之后的代码 const addMap = () => { mvtMap = scene.addVectorTilesMap({ url: "http://localhost:8090/iserver/services/map-mvt-XueXiaoLuChengShiXiao2/restjsr/v1/vectortile/maps/%E5%AD%A6%E6%A0%A1%E8%B7%AF%E7%A8%8B%E6%97%B6%E6%95%88", canvasWidth: 512, name: 'testMVT', viewer: viewer }); // 等待地图加载完成 const mapboxStyle = mvtMap.mapboxStyle; const layers = mapboxStyle?.layers || []; console.log('地图加载完成,图层数量:', layers.length); // 地图添加成功后,立即获取并填充图层列表 // populateLayerList(); };

1个回答

您好,

首选确认在该版本的示例程序中是否能正常加载mvt服务,如果可以则可能是以下原因:

scene.addVectorTilesMap是异步方法,需要等待加载完成后才可以读取mvtMap对象属性,可以如示例代码使用SuperMap3D.when方法,在回调函数中操作mvtMap对象。

如仍有问题,请提供更多信息,如关键代码截图等。
180EXP 2025年08月26日
好的,谢谢回答,添加方法后已解决
...