Google maps 在谷歌地图上画多边形

Google maps 在谷歌地图上画多边形,google-maps,Google Maps,我需要在谷歌地图上画一个相机视角。这与最大180°的视角相对应,但如果角度更大,我需要另一种解决方案,而不是绘制三角形 以下是我想要实现的一个示例: 有人知道我该怎么做吗? 中心点是标记 这是我绘制角度小于180度的代码: var fillTriangles = []; fillColorVAR = "#007caf"; fillOpacityVAR = ""; fillAlphaVAR = "0.25"; strokeColorVAR = "#0000

我需要在谷歌地图上画一个相机视角。这与最大180°的视角相对应,但如果角度更大,我需要另一种解决方案,而不是绘制三角形

以下是我想要实现的一个示例:

有人知道我该怎么做吗? 中心点是标记

这是我绘制角度小于180度的代码:

    var fillTriangles = [];
    fillColorVAR = "#007caf";
    fillOpacityVAR = "";
    fillAlphaVAR = "0.25";
    strokeColorVAR = "#000000";

    var this_marker_home = marker.getPosition();
    var startPoint = new LatLon(this_marker_home.lat(), this_marker_home.lng());

    // prepare the direction for point calculation
    var pointOneDirection = parseInt(300) - ( 90 / 2 );
    var pointTwoDirection = parseInt(300) + ( 90 / 2 );

    // other points needed for the triangle
    var pointOne = startPoint.destinationPoint(pointOneDirection, 0.5);
    var pointTwo = startPoint.destinationPoint(pointTwoDirection, 0.5);

    // make a triangle with fill
    var fillTrianglePath = [
        new google.maps.LatLng(this_marker_home.lat(), this_marker_home.lng()),
        new google.maps.LatLng(pointOne.lat, pointOne.lon),
        new google.maps.LatLng(pointTwo.lat, pointTwo.lon),
        new google.maps.LatLng(this_marker_home.lat(), this_marker_home.lng())
    ];
    fillTriangles = new google.maps.Polygon({
        paths       : fillTrianglePath,
        strokeWeight: 0,
        fillColor   : fillColorVAR,
        fillOpacity : fillAlphaVAR
    });
    fillTriangles.setMap(map);

    // make a line as an open stroke for the fill
    var strokeTrianglePath = [
        new google.maps.LatLng(pointOne.lat, pointOne.lon),
        new google.maps.LatLng(this_marker_home.lat(), this_marker_home.lng()),
        new google.maps.LatLng(pointTwo.lat, pointTwo.lon)
    ];
    strokeTriangles = new google.maps.Polyline({
        path         : strokeTrianglePath,
        geodesic     : true,
        strokeColor  : strokeColorVAR,
        strokeOpacity: 1.0,
        strokeWeight : 2
    });
    strokeTriangles.setMap(map);

让我正确地理解你是否试图获得上面的形状(圆减去三角形)?不,我需要一个半径为0-X度的圆。我已经用这个例子做了: