首页 / 浏览问题 / WebGIS / 问题详情
MapBoxStyles报错olLayer.get is not a func
3EXP 2023年10月23日
使用产品:iserver 11i 操作系统:win10 x64 数据类型:文件型 问题详细描述: 问题:new MapboxStyles报错 Uncaught TypeError: olLayer.get is not a function; 依赖环境: openlayers: 7.3.0 ol-mapbox-style: 12.0.0 @supermap/iclient-ol: 11.1.0-a 代码: import * as olms from 'ol-mapbox-style' import { VectorTileSuperMapRest, MapboxStyles } from '@supermap/iclient-ol' import { Feature } from 'ol' import { VectorTile } from 'ol/layer' import { MVT } from 'ol/format' window.olms = olms const url = `${iserverUrl}/iserver/services/${serviceName}/rest/maps/${layerName}` const mapboxStyle = new MapboxStyles({ url }) mapboxStyle.on('styleLoaded', () => { const vectorLayer = new VectorTile({ declutter: true, style: mapboxStyle.featureStyleFuntion, source: new VectorTileSuperMapRest({ url, format: new MVT({ featureClass: Feature }), tileType: 'ScaleXY' }) }) map.addLayer(vectorLayer) //添加图层 })
问题关闭原因: 格式错乱
...