如何修改地物样式的图片或文字?

How to modify image or text of style of feature?

在openlayers3中,在Style Object中,没有set('')的方法,也没有setImage()setText()的方法。如果我想修改图片角度或文字内容,有人知道怎么做吗?

  1. ol.Feature#getStyle returns一个ol.style.Style(或一个array);
  2. ol.style.Style#getText returns一个ol.style.Text;
  3. ol.style.Text#setText就是你想要的。

所以可以是这样的:

feature.getStyle().getText().setText('new content');