最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Add border to polyline google maps - Stack Overflow

programmeradmin3浏览0评论

I would like to add border around a polyline the same as the following picture:

Can I do it, is it possible? I have search the web for solutions for this problem and no so far.

I would like to add border around a polyline the same as the following picture:

Can I do it, is it possible? I have search the web for solutions for this problem and no so far.

Share Improve this question asked Nov 14, 2016 at 14:10 BrkBrk 1,2972 gold badges24 silver badges58 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 23

The trick would be to add two polylines, a thick black one that will do the border and a green one, less thick.

That way, because the green one is going to appear on top of the black one, but the sides of the black one are still going to be visible, it is going to act as a border.

Here's a sample of code to illustrate:

var border = new google.maps.Polyline({
    path: path,
    strokeColor: 'black', // border color
    strokeOpacity: 1.0,
    strokeWeight: 7 // You can change the border weight here
});

var line = new google.maps.Polyline({
    path: path, // /!\ same path
    strokeColor: 'green',
    strokeOpacity: 1.0,
    strokeWeight: 4
});
发布评论

评论列表(0)

  1. 暂无评论