美文网首页
openlayers 加载KML文件

openlayers 加载KML文件

作者: MarvinCHN | 来源:发表于2020-03-29 22:10 被阅读0次

在设置style样式时,发现不起作用,需要设置一个属性 extractStyles: false

import VectorLayer from 'ol/layer/Vector'
import VectorSource from 'ol/source/Vector'
import KML from 'ol/format/KML'

createWFS (option) {
const WFS = new VectorLayer({
source: new VectorSource({
url: option.url,
format: new KML({
extractStyles: false
})
}),
style: option.style
})
return WFS
}

相关文章

网友评论

      本文标题:openlayers 加载KML文件

      本文链接:https://www.haomeiwen.com/subject/oodpuhtx.html