在用高德地图做路线规划时碰到一个问题,将多个坐标对象拼接成作为参数传递出现问题,如下为范例中,我需要把其中的两个经纬度坐标用我数据库中取得的坐标变量替换
 driving.search(new AMap.LngLat(116.379028, 39.865042), new AMap.LngLat(116.427281, 39.903719));高德范例链接: http://lbs.amap.com/api/javascript-api/example/driving-route/plan-route-according-to-lnglatvar Pos1="[116.37902,39.865042]";
var Pos2="[116.42728,39.903719]";
var DrivePath=Pos1+","+Pos2;
var s=eval("["+DrivePath+"]");
用以上拼接两个坐标传递时,无法得到范例中的结果,请各位指教,谢谢!
    driving.search(s, function(status, result){
if(status === 'complete' && result.info === 'OK'){
alert(result.routes[0].distance);
alert(result.routes[0].time);
(new Lib.AMap.DrivingRender()).autoRender({
data: result,
                map: map,
                panel: "panel"
            });
}else{
             alert(result);
        }
});