我的github
posts - 3243,  comments - 42,  views - 158万

似乎只能给点要素添加标注??

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
              //   })
              // })
posted on   XiaoNiuFeiTian  阅读(2583)  评论(0编辑  收藏  举报
编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)
历史上的今天:
2020-11-25 ARCGIS中按某字段属性值分类导出
2020-11-25 CGI应用程序
2019-11-25 OverFeat:基于卷积网络的集成识别、定位与检测
2018-11-25 对“机器视觉”的一点思考
2013-11-25 基于VRML的虚拟校园漫游系统
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示