我想用谷歌地图来实现:
       比如说:我的出发点是:重庆      目的地是:三亚       当我输入后一点搜索后;就在谷歌地图上面把这条路中间要经过的所有的景点全部显示出来;  当然,我会先把经过的景点整理出来;  可是怎么才能让它在地图上面给用线连在一起呢

解决方案 »

  1.   

    先一下,我上次google map二次开发过,暂没涉及到这个连线问题,关注一下。
      

  2.   

    function calcRoute() {
                //出发地
                var start = document.getElementById("start").value;
                //目的地
                var end = document.getElementById("end").value;
                //出行方式
                var selectedMode = document.getElementById("TravelMode").value;            var image = new google.maps.MarkerImage('IMG/icon.png',
                            new google.maps.Size(19, 30));
                var request = {
                    origin: start,
                    destination: end,
                    travelMode: google.maps.DirectionsTravelMode[selectedMode]
                };
                directionsService.route(request, function (response, status) {
                    if (status == google.maps.DirectionsStatus.OK) {
                        directionsDisplay.setDirections(response);
                    }
                });
                var location = new google.maps.LatLng(28.681984, 115.906947);
                var er = new google.maps.Marker({
                    position: location,
                    map: map,
                    icon: image
                });
                er.setTitle("1");
                attachSecretMessage(er, 0);
            }
     <strong>出发地: </strong>
            <input id="start" type="text" />
            <strong>目的地: </strong>
            <input id="end" type="text" style="width:200px;" />
            <strong>出行方式: </strong>
            <select id="TravelMode">
                <option value="WALKING">步行</option>
                <option value="DRIVING">乘车</option>
            </select>
            <input id="searchButton" type="button" value="搜索路线" onclick="calcRoute();" />
    一个前辈的代码。
    行车路线
      

  3.   

    http://code.google.com/intl/zh-CN/apis/maps/documentation/javascript/overlays.html#PolylineOptions上面例子很多,包括折线,浅显易懂!!