首页 / 浏览问题 / 云GIS / 问题详情
iClient-mapboxgl 添加多个矢量瓦片服务
256EXP 2020年04月21日
通过iserver发布了多个矢量瓦片服务(ugcv5(mvt)-restjsr),请问在mapboxgl中如何添加多个矢量瓦片地图。

例如有下面三个:

1./iserver/services/map-mvt-Map1/restjsr/v1/vectortile/maps/Map

2./iserver/services/map-mvt-Map2/restjsr/v1/vectortile/maps/Map

3./iserver/services/map-mvt-Map3/restjsr/v1/vectortile/maps/Map

1个回答

您好,您可以根据以下例子进行添加 

map.on('load', function() {
         map.addStyle('https://iserver.supermap.io/iserver/services/map-china400/restjsr/v1/vectortile/maps/China_4326/style.json'
            )

         map.addStyle('http://localhost:8090/iserver/services/map-mvt-mianlocalhostwfs/restjsr/v1/vectortile/maps/mian@localhost_wfs/style.json')

})

3,352EXP 2020年04月21日
好的,等我测试一下。
Uncaught TypeError: map.addStyle is not a function
                map.on('load', function () {
                    //加载矢量管网图层(MVT)
                    for (let i = 0; i < SupScene.length; i++) {
                        if (SupScene[i].MVTSerUrl) {
                            let styleURL = SupScene[i].MVTSerUrl + "/style.json";
                            console.log(styleURL);
                            map.addStyle(styleURL);
                        }
                    }
                })

只有第一个能加进去,后面的加不进去了,报错。

Error: There is already a source with this ID

at mapbox-gl-enhance.js:33

这个增强mapboxgl的插件有文档嘛?
...