查询从某地来到这里线路' // 信息窗口标题 //,enableMessage:true //设置允许信息窗发送短息,1.5版支持 //,message:"" }, infoWindow = new BMap.InfoWindow("
到这
", opts); // 创建信息窗口对象 infoWindow.disableAutoPan(); marker.openInfoWindow(infoWindow); map.centerAndZoom(thisPoint,zoomParam); } //公交线路查询 function bus_end(){ var nowaddress = document.getElementById("point_end_show").value; nowaddress = nowaddress ? nowaddress : document.getElementById("point_end").value; document.getElementById("point_end_box").innerHTML = '正为您获取公交路线,请稍后...'; //map.centerAndZoom(thisPoint, 14); var driving = new BMap.TransitRoute(map, { renderOptions: {map: map, panel: "results", autoViewport: true} }); driving.setPolicy(BMAP_TRANSIT_POLICY_LEAST_WALKING); /* BMAP_TRANSIT_POLICY_LEAST_TIME 最少时间。 BMAP_TRANSIT_POLICY_LEAST_TRANSFER 最少换乘。 BMAP_TRANSIT_POLICY_LEAST_WALKING 最少步行。 BMAP_TRANSIT_POLICY_AVOID_SUBWAYS 不乘地铁。 */ driving.setSearchCompleteCallback(function(results){ if(results.getNumPlans()==0){ alert('抱歉,无法查询到公交路线,请填详细起点地址'); } }); driving.setPageCapacity(5); driving.setResultsHtmlSetCallback(function(){ show_thendrive(); if(scrollObj)scrollObj.refresh(); }); driving.search(nowaddress, thisPoint); } //自驾线路查询 function drive_end(){ var nowaddress = document.getElementById("point_end_show").value; nowaddress = nowaddress ? nowaddress : document.getElementById("point_end").value; document.getElementById("point_end_box").innerHTML = '正为您获取自驾车路线,请稍后...'; //map.centerAndZoom(thisPoint, 14); var driving = new BMap.DrivingRoute(map, { renderOptions: {map: map, panel: "results", autoViewport: true} }); driving.setSearchCompleteCallback(function(results){ if(results.taxiFare==null){ alert('抱歉,暂无自驾路线可供参考,请填详细起点地址'); }else{ //alert("打车总费用为:"+results.taxiFare.day.totalFare+"元"); } }); driving.setResultsHtmlSetCallback(function(){ show_thendrive(); if(scrollObj)scrollObj.refresh(); }); driving.search(nowaddress, thisPoint); } function show_thendrive(){ document.getElementById("showRoute").style.display = 'none'; document.getElementById("results_box").style.display = 'block'; } function hide_thendrive(isclose){ if(isclose)document.getElementById("showRoute").style.display = 'block'; document.getElementById("results_box").style.display = 'none'; } function GetCityName(result){ var cityName = result.name;//map.setCenter(cityName); document.getElementById("point_end").value = cityName; } if(!is_SYStem && window.BMap){ var GetMyCity = new BMap.LocalCity(); GetMyCity.get(GetCityName); }