【发布时间】:2016-04-17 18:10:52
【问题描述】:
在地图上画一个圆圈很容易:
https://developers.google.com/maps/documentation/javascript/examples/circle-simple
但是,如果我在一个点周围画一个圆,我还想向用户表明半径有多大,有没有办法在圆上(例如在周长上)添加指示半径的文本?
【问题讨论】:
标签: javascript google-maps google-maps-api-3
在地图上画一个圆圈很容易:
https://developers.google.com/maps/documentation/javascript/examples/circle-simple
但是,如果我在一个点周围画一个圆,我还想向用户表明半径有多大,有没有办法在圆上(例如在周长上)添加指示半径的文本?
【问题讨论】:
标签: javascript google-maps google-maps-api-3
为谷歌地图添加一个好的时尚文本的简单方法是使用谷歌地图实用程序,在你的情况下是 yh js-map-label
https://github.com/googlemaps/js-map-label
查看此示例页面查看源:https://googlemaps.github.io/js-map-label/examples/maplabel.html
var mapLabel = new MapLabel({
text: 'Test',
position: new google.maps.LatLng(34.03, -118.235),
map: map,
fontSize: 35,
align: 'right'
});
mapLabel.set('position', new google.maps.LatLng(34.03, -118.235));
var marker = new google.maps.Marker();
marker.bindTo('map', mapLabel);
marker.bindTo('position', mapLabel);
marker.setDraggable(true);
【讨论】: