Openlayers為線要素添加文字標注


似乎只能給點要素添加標注??

1. 加載矢量點實現標注

2. 使用重疊層實現標注

參考:https://blog.csdn.net/qq_35732147/article/details/81771953(OpenLayers之標注功能二:圖文標注)

為marker添加標注:https://q.cnblogs.com/q/27959/

openlayers給要素加文字注記:https://blog.csdn.net/u013594477/article/details/83584294

openlayers文字標注 (九):https://blog.csdn.net/m0_37797410/article/details/106503770

 

怎么給線標注呢?

openlayers實現帶箭頭的線路polyline:https://zhuanlan.zhihu.com/p/336831271

How to add style in polyline in openLayers?:https://stackoverflow.com/questions/64143861/how-to-add-style-in-polyline-in-openlayers

How to add text to LineString in OpenLayers?

Setting OpenLayers line labels by angle?:https://gis.stackexchange.com/questions/333475/setting-openlayers-line-labels-by-angle

不知怎么滴,又可以了:

方法一:

text: new ol.style.Text({
                        font: '13px Microsoft YaHei',
                        text:  name,
                        textAlign:"left",
                        fill: new ol.style.Fill({
                            color: '#666'
                        }),
                        stroke: new ol.style.Stroke({
                          color: '#f2f',
                          width: 1
                        })
             })
方法二:
              // text: new ol.style.Text({
              //   text:'aaaaa',
              //   font: '14px Verdana',
              //   fill: new ol.style.Fill({
              //     color: '#000000'
              //   }),
              //   stroke: new ol.style.Stroke({
              //     color: '#f2f',
              //     width: 1
              //   })
              // })


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM