//矢量标注样式设置函数,设置image为图标ol.style.Icon
function createLabelStyle(feature, icon, scale, opacity) {
return (new ol.style.Style({
image: new ol.style.Icon({
opacity: opacity,
src: icon,
scale: scale // 标注图标大小
}),
text: new ol.style.Text({
textAlign: "center", // 位置
textBaseline: "middle", // 基准线
font: "normal 12px 微软雅黑", // 文字样式
text: feature.get("name"),
fill: new ol.style.Fill({
// 文本填充样式(即文字颜色)
color: "#333"
}),
stroke: new ol.style.Stroke({
color: "#Fff",
width: 1
})
})
}));
}
// 添加标注
function draw(arr, icon, scale, opacity) {
var me = this;
/*********************显示地标**************************/