简体   繁体   English

如何在Google地图中创建方向标记(角度)?

[英]How can I create a Directional(Angled) Marker in Google Maps?

I have the angle of the marker, I just want that the marker gets rotated to that angles. 我有标记的角度,我只想让标记旋转到那个角度。

marker = new google.maps.Marker({
                position: myLatlng,
                location: LocInfo,
                map: map,
                title: titleInfo,
                icon: image,
                html: text,
                angle: 150 // i want to do something like this
            });

Is there any property like angle property that I can use like in above example? 是否可以像上面的示例一样使用诸如angle属性的任何属性?

After a few search I have found the answer and it works. 经过几次搜索,我找到了答案,并且可以正常工作。

var angleDegrees = 150;
    new google.maps.Marker({
        position: a,
        map: map,
        icon: {
            path: google.maps.SymbolPath.FORWARD_CLOSED_ARROW,
            scale: 6,
            fillColor: "red",
            fillOpacity: 0.8,
            strokeWeight: 2,
            rotation: angleDegrees //this is how to rotate the pointer
        }  
    });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM