function layL_10DiLevfun(feature){
return new ol.style.Style({
image: new ol.style.Icon(({
rotateWithView: true,
anchor: noteanchorsize, //标注图片和文字之间的距离
opacity: 1,
size: imagesize,
src: noteimagesrc,
})),
text: new ol.style.Text({
text: feature.get('name'),
textAlign: 'center', //对齐方式
textBaseline: 'middle', //文本基线
offsetX: 0,
offsetY: 0,
font: 'bold 16px "tenLev", "Arial Unicode MS", "sans-serif"',
placement: 'point', //当使点的时候 使用这行
fill: new ol.style.Fill({ //填充样式
color: 'black'
}),
stroke: new ol.style.Stroke({ //笔触
color: 'white',
width: 1
}),
}),
});
}
var layL_10DiLev = new ol.layer.Vector({
source: new ol.source.Vector({
format: new ol.format.GeoJSON(),
url: 'json/result_10dilev.geojson' //线名
}),
style:layL_10DiLevfun,
extent: layerExtent,
});
注记加个图片样式
return new ol.style.Style({
image: new ol.style.Icon(({
rotateWithView: true,
anchor: noteanchorsize, //标注图片和文字之间的距离
opacity: 1,
size: imagesize,
src: noteimagesrc,
})),
text: new ol.style.Text({
text: feature.get('name'),
textAlign: 'center', //对齐方式
textBaseline: 'middle', //文本基线
offsetX: 0,
offsetY: 0,
font: 'bold 16px "tenLev", "Arial Unicode MS", "sans-serif"',
placement: 'point', //当使点的时候 使用这行
fill: new ol.style.Fill({ //填充样式
color: 'black'
}),
stroke: new ol.style.Stroke({ //笔触
color: 'white',
width: 1
}),
}),
});
}
var layL_10DiLev = new ol.layer.Vector({
source: new ol.source.Vector({
format: new ol.format.GeoJSON(),
url: 'json/result_10dilev.geojson' //线名
}),
style:layL_10DiLevfun,
extent: layerExtent,
});
注记加个图片样式