我的程式有問題。這是一個關於地理資訊系統的程序,使用了LeatlefJs函式庫,我還使用了letlef路由機功能。問題是系統無法顯示它應該能夠顯示的路線,我不太明白。這是腳本。
function getDirectRoute(index, callbackFunction){ var dari = marker_awal.getLatLng().lat + "," + marker_awal.getLatLng().lng; var tujuan = markerCabang[index].getLatLng().lat + "," + markerCabang[index].getLatLng().lng; $.ajax({ type: "GET", url: "http://localhost:8989/route?point=" + dari + "&point=" + tujuan + "&points_encoded=false&instructions=false&vehicle=motorcycle&ch.disable=true&weighting=shortest&algorithm=alternative_route", dataType: 'json', contentType: "application/json", success: function (data) { successReveived++; var coordinates = data.paths[0].points.coordinates; tempDistance = 0; for(var j=0; j<coordinates.length; j++){ if(j==0){ tempDistance += euclidean(marker_awal.getLatLng().lat, marker_awal.getLatLng().lng, coordinates[j][1], coordinates[j][0]); } else { tempDistance += euclidean(coordinates[j-1][1], coordinates[j-1][0], coordinates[j][1], coordinates[j][0]); } } distanceGH[index] = data.paths[0].distance; distanceManual[index] = tempDistance.toFixed(4); if(successReveived == markerCabang.length && typeof(callbackFunction == 'function')){ callbackFunction(); } } }); }
錯誤是這樣的
無法載入資源:net::ERR_CONNECTION_REFUSED http://localhost:8989/route?point=3.611967691620835,98.67254734039308&point=3.611126,67254734039308&point=3.611126,98.6758898.6758 =true&加權=最短&演算法=alternative_route
(我還不能發表評論,所以試著幫你回答)