// 不规则图形
const polygon = new Feature({
geometry: new Polygon([
fromLonLat([117.227239, 31.820586]),
fromLonLat([117.327239, 31.820586]),
fromLonLat([117.327239, 31.920586])
])
})
polygon.setStyle(
new Style({
fill: new Fill({
color: '#f00' // 填充色
}),
stroke: new Stroke({
color: '#f00', // 边框色
width: 2 // 边框尺寸
}),
text: new Text({
testAlign: 'center', // 文本位置
text: '中心位置', // 文本
font: '14px 微软雅黑', // 文本字体样式
fill: new Fill({
color: '#f00' // 文本颜色
})
})
})
)
08-16