Openlayers 要素添加多个样式
首先是定义一个layer: ///点图 function createTmpVector ( ) { vectorSource = new ol . source . Vector ( { format : new ol . format . GeoJSON ( ) } ) ; toolVector = self . options . vector = new ol . layer . Vector ( { id : 'toolQueryVector' , type : 'mainVector' , source : vectorSource , zIndex : 99 } ) mapHelper . map . addLayer ( toolVector ) ; } 然后就是给要数添加样式: 方法一,是在定义图层时添加有个style的返回函数: style : function ( feat ) { var imageSrc = feat . get ( 'info' ) . Values . img ; return new ol . style . Style ( { image : new ol . style . Icon ( { src : imageSrc , } ) } ) } , 方法二,使用ol.styleFunction: for ( var i in