【发布时间】:2019-02-26 18:44:24
【问题描述】:
我正在尝试获取坐标中文本字段的宽度,即地图上文本字段的起始坐标和结束坐标。我的代码如下:
map.on('load', function () {
map.addLayer({
"id": "labels",
"type": "symbol",
"source": {
"type": "geojson",
"data": {
"type": "FeatureCollection",
"features": [{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [-119.4179, 36.7783]
}
}]
}
},
"layout": {
"icon-image": "harbor-15",
"text-field": "Testing city name",
"text-font": ["Open Sans Semibold", "Arial Unicode MS Bold"],
"text-offset": [0, 0.6],
"text-anchor": "top",
"text-allow-overlap": true
}
});
从上面,我想只获得文本字段的确切开始和结束坐标。有人能说这是否可能吗?
【问题讨论】:
标签: javascript mapbox mapbox-gl-js mapbox-marker