此处地图Polygon的官方文档不包含任何有关如何为多边形添加标签的参考。
多边形文档 - https://developer.here.com/documentation/maps/topics_api/h-map-polygon.html
此处地图多边形示例 - https://developer.here.com/api-explorer/maps-js/v3.0/geoshapes/polygon-on-the-map
答案 0 :(得分:0)
我没有找到简单的方法,但是用几行代码,您可以创建一个仅包含您的文本的自定义svg“图标”,并将其显示在地图上的任何位置:
var my_text = 'My text';
var svg = '<svg width="80" height="24" xmlns="http://www.w3.org/2000/svg"><text x="0" y="20" font-size="10pt" font-family="Arial">' + my_text + '</text></svg>';
var icon = new H.map.Icon(svg);
var marker = new H.map.Marker({lat: 52.5, lng: 13.4 }, {icon: icon});
map.addObject(marker);
在柏林上方显示“我的文字”。您可以在此example from the HERE documentation上找到更多文档。