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

时间:2013-09-19 03:48:56

标签: javascript jquery google-maps google-maps-markers

我有标记的角度,我只想让标记旋转到那个角度。

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

在上面的示例中是否可以使用像angle属性这样的属性?

1 个答案:

答案 0 :(得分:2)

经过几次搜索后,我找到了答案并且确实有效。

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