如何改变GeolocationMarker的圆的半径 [英] how to change the radius of the circle of GeolocationMarker
问题描述
我试图将GeolocationMarker资料库的圆圈半径改为3公里;这里是我的尝试:
I'm trying to change the radius of the circle of the GeolocationMarker library to 3 km; here is my attempt:
var geoMarker = new GeolocationMarker();
geoMarker.setCircleOptions({radius: 3000});
geoMarker.setMap(map);
但它不会改变圆的半径,即半径不在3公里。我该如何解决它?谢谢
But it doesn't change the radius of the circle, that is the radius isn't at 3 km. How can I fix it? Thanks
推荐答案
不能这样做,您链接到的文档声明:
It can't be done like this, the documentation you link to states:
setCircleOptions(options:google.maps.CircleOptions)此方法将
忽略google.maps.CircleOptions对象的某些属性。
会忽略位置,半径和贴图属性,因为它们是由库
设置的。
setCircleOptions(options:google.maps.CircleOptions) This method will ignore certain properties of the google.maps.CircleOptions object. It will ignore position, radius and map properties as these are set by the library.
圆的半径是地理位置数据的准确度。如果您想要一个固定半径的圆圈,请创建一个圈子对象,然后绑定中心属性到Geolocation标记。
The radius of the circle is the accuracy of the geolocation data. If you want a constant radius circle, create a Circle object and bind the center property to the Geolocation Marker.
var circle = new google.maps.Circle({raidus: 3000});
circle.bindTo("center", geoMarker, "position");
这篇关于如何改变GeolocationMarker的圆的半径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!