首页 / 浏览问题 / WebGIS / 问题详情
iClient Openlayers如何将iServer的地图服务发布的每一个图层作为矢量图层添加
284EXP 2025年10月09日
想要在iClient for Openlayers里实现控制地图里每一个图层显示风格的功能,但直接调用整个地图服务会导致不包含子图层,只能使用layersid控制子图层显隐

如果想操控子图层的风格的话,请问应该如何将地图服务里的每一个子图层作为矢量图层添加

1个回答

您好,可以用OpenLayers加载map服务的矢量瓦片接口,通过修改vectorstyles.json中子图层的风格,再在前端使用修改后的风格渲染

例如:https://iclient.supermap.io/examples/openlayers/editor.html#mvtvectorlayer_mbstyle_linestyle

1,376EXP 2025年10月09日

请问范例里发布的这个map-mvt-California地图服务是如何发布的,我看里面的功能和普通的地图服务又或是矢量瓦片服务都不一样。

请问是iServer11.1.0和11.3.0的区别吗

如果是发布的工作空间,可以直接在http://localhost:8090/iserver/services/map-xxx/rest/maps/xxx/tileFeature/vectorstyles.json中获取到风格服务,或者发布服务时,勾选矢量瓦片服务(例如:https://iclient.supermap.io/examples/openlayers/editor.html#mvtvectorlayer_vectortilerest)。

示例使用的是发布的UGCV5(MVT)矢量瓦片服务

感谢解答
您好,我试着取得了一下地图服务和矢量瓦片服务里的的vectorstyles.json或者style.json,

但无论是哪一种放到以下代码里都无法走进styleloaded里去,请问这是为什么:

地图服务:“http://localhost:8091/iserver/services/map-xxx/rest/maps/mapName/tileFeature/vectorstyles.json?type=MapBox_GL”

矢量瓦片服务:"http://localhost:8091/iserver/services/map-xxx/restjsr/v1/vectortile/maps/mapName/style.json"

var style = new ol.supermap.MapboxStyles({
        style: styleURL,
        map: map
    })
    style.on('styleloaded', function () {}
...