使用JavaScript在Google地图上绘制虚线圆 [英] Draw Dotted circle on Google Maps using JavaScript

查看:155
本文介绍了使用JavaScript在Google地图上绘制虚线圆的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是google maps api的新手,我不知道如何在google maps上创建虚线圆.我已使用以下代码在Google地图上创建了圆圈

I am new to google maps api I don't know how to create dotted circle on google maps. I have created circle on google maps using the following code

circle = new google.maps.Circle({
strokeColor: Settings.CircleRadius.strokeColor, 
strokeOpacity: Settings.CircleRadius.strokeOpacity,
strokeWeight: Settings.CircleRadius.strokeWeight,
fillColor: #0000FF,
fillOpacity: Settings.CircleRadius.fillOpacity,
center: click_latlon, 
map: map,
//clickable: true,
radius: radius_m   //Radius in meters 
});

有人可以帮助我如何在Google地图上绘制虚线圆.

Can someone help me how to draw dotted circle on google maps.

推荐答案

这是虚线折线的代码,您可以尝试尝试类似的圆

Here is the code for the dotted polyline, You can have a try for something similar for a circle

 // Define a symbol using SVG path notation, with an opacity of 1.
    var lineSymbol = {
      path: 'M 0,-1 0,1',
      strokeOpacity: 1,
      scale: 4
    };

    // Create the polyline, passing the symbol in the 'icons' property.
    // Give the line an opacity of 0.
    // Repeat the symbol at intervals of 20 pixels to create the dashed effect.
    var line = new google.maps.Polyline({
      path: [{lat: 22.291, lng: 153.027}, {lat: 18.291, lng: 153.027}],
      strokeOpacity: 0,
      icons: [{
        icon: lineSymbol,
        offset: '0',
        repeat: '20px'
      }],
      map: map
    });

这篇关于使用JavaScript在Google地图上绘制虚线圆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆