我想在OpenLayers3中为特定的ol.Feature添加样式,我尝试了下面解释的方法,但它不起作用。
vectorsrc.addFeature(
new ol.Feature({
geometry: new ol.geom.Point(0,0).transform('EPSG:4326', 'EPSG:3857'),
style: new ol.style.Style({
image: new ol.style.Icon(/** @type {olx.style.IconOptions} */ ({
anchor: [0.5, 46],
size: [32, 48],
anchorXUnits: 'pixels',
anchorYUnits: 'pixels',
src: '/image/icon.png'
}))
})
);