openlayer通过FeatureCollection对象方式加载feature

 常用styleFunc

var styleFunc = function (feature) {
  var property = feature.getProperties();
  return new ol.style.Style({
    // 图片
    image: new ol.style.Icon({
      src: '../../images/windAlter.png',
      anchor: [0.5, 0.5],
      //size: [76, 68],
      offset: [0, 0],
      opacity: 1,
      scale: 1,
      rotation: property.CompCourseAngle * Math.PI / 180
    }),
    // 字体
    text: new ol.style.Text({
      font: '16px 微软雅黑 ',
      text: property.name,
      fill: new ol.style.Fill({
        color: '#021935'
      }),
      stroke: new ol.style.Stroke({
        color: 'rgba(0,0,0,0)',
        width: 1
      }),
      //offsetX: 12,
      offsetY: -34
    }),
    // 圆形
    image: new ol.style.Circle({
      // 圆形颜色
      fill: new ol.style.Fill({
        color: '#00f'
      }),
      // 圆形半径
      radius: 6,
    }),
    image: new ol.style.RegularShape({
      points: 5,
      radius: 10,
      fill: new ol.style.Fill({
        color: 'blue'
      })
   

你可能感兴趣的:(openlayer通过FeatureCollection对象方式加载feature)