Openlayers 3: add text label to feature

前端 未结 2 922
再見小時候
再見小時候 2021-02-09 00:07

I have the current set up here: fully functional fiddle example and whilst I have managed to zoom to each polygon feature I would also like to display a centralised text label o

2条回答
  •  离开以前
    2021-02-09 00:35

    Since I am new here and are not allowed to comment, I put my comment as a new answer to the question of @andre_ss6. I also get Window on this. What works for me is passing in the feature object as the function's first parameter:

    function styleFunction(feature) {
    

    and then use that parameter instead of this:

    text: feature.get('description')
    

提交回复
热议问题