openlayer3 常用梳理-设置点的样式

feature 对象中的点设置样式:

var startMarker = new ol.Feature({
        type: 'start',
        geometry: new ol.geom.Point(routeCoords[0])
      });

'start': new ol.style.Style({

            image: new ol.style.Icon({
              anchor: [0.5, 1],
              src: root+'static/ol/image/start_point.png'
            }),
            text:new ol.style.Text({
                  text:'12:35',
                 font: '12px Calibri,sans-serif',
                 offsetY:-12
                 ,
                fill: new ol.style.Fill({
                  color: 'yellow'
                })
              })

          })

feature 对象中的点获取样式:

startMarker.get('type')


你可能感兴趣的:(openlayer3 常用梳理-设置点的样式)