使用Google地图指南服务的Google地图折线

时间:2012-05-10 06:34:16

标签: google-maps google-maps-api-3

现在我的应用程序上的Rigth我以这种方式生成折线,我收到一个数组“路径”,其中包含我从数据库获得的所有标记,可以生成折线:

var routeArray = null;
function drawRoute(mapa, routeArray, varBool){
    if(!routeArray){
        var coordRoute = routeArray;
        routeArray= new google.maps.Polyline({
            map: map,
            path: coordRoute,
            geodesic: true,
            strokeColor: "#FF0000",
            strokeOpacity: 1.0,
            strokeWeight: 3
        });
    }if(varBool){
        routeArray.setMap(map);
    }else{
        routeArray.setMap(null);
    }
}

我想生成折线,但是这样你会看到直线,我更喜欢Google Directions Service。有什么建议吗? 提前谢谢。

1 个答案:

答案 0 :(得分:1)

您是否检查了the google direction api docs的使用信息和示例?你有没有尝试过什么?如果您有任何疑问/问题,请发布新代码,我们可以提供进一步的帮助。