how to change the radius of the circle of GeolocationMarker

纵然是瞬间 提交于 2019-12-26 02:09:52

问题


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);

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


回答1:


It can't be done like this, the documentation you link to states:

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.

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");


来源:https://stackoverflow.com/questions/23740696/how-to-change-the-radius-of-the-circle-of-geolocationmarker

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!