при использовании такой ссылки
http://maps.google.com/maps?f=d&hl=en&saddr=25.04202,121.534761
&daddr=25.05202,121.554761&ie=UTF8&0&om=0&output=kml
вернет значение координат, как показано ниже:
121.534760,25.042040,0.000000
121,533650,25.042190,0.000000 121.532950,25.042430,0.000000 121.532950,25.042430,0.000000 121.532980,25.044400,0.000000 121.532980,25.044400,0.000000 121.534000,00500 121,000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 121,543860,25,047490,0,000000 121,546430,25.048160,0,000000 121,549130,25,048140,0,000000 121,549130,25.048140,0,000000 121,550770,25,048110,0,00,000000 121,55,5,00,000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 121,552640,25.051680,0.000000 121.552640,25.051680,0.000000 121.552660,25.052280,0.000000 121.552660,25.052280,0.000000 121.553770,25.052260,0.000000 121.553770,25.052260,0.000000 121.554770,25.052240,005
но в моем javascript он вернул примерно несколько координат, 5-6 координат
Вот мой код для получения координат:
function route(FromPlace,ToPlace){
if(!FromPlace&&!ToPlace){
FromPlace = new google.maps.LatLng(13.692941, 100.750723);
ToPlace = document.getElementById("endPoint").value;
}
//directionsService = new google.maps.DirectionsService();
var request = {
origin: FromPlace,
destination: ToPlace,
travelMode: google.maps.DirectionsTravelMode.DRIVING
};
directionsService.route(request, function(response, status) {
if (status == google.maps.DirectionsStatus.OK)
{
directionsDisplay.setDirections(response);
for (var i = 0; i < response.routes[0].legs.length; i++) {
for (var j = 0; j < response.routes[0].legs[i].steps.length; j++) {
if(j == response.routes[0].legs[i].steps.length-1){
addressRoute = addressRoute+response.routes[0].legs[i].steps[j].end_point.lat()+","
+response.routes[0].legs[i].steps[j].end_point.lng()+"";
latitude = response.routes[0].legs[i].steps[j].end_point.lat();
longitude = response.routes[0].legs[i].steps[j].end_point.lng();
destinationDB = latitude +","+ longitude;
}else{
addressRoute = addressRoute+response.routes[0].legs[i].steps[j].end_point.lat()+","
+response.routes[0].legs[i].steps[j].end_point.lng()+"|";
}
}
}
//document.getElementById("textLocation").innerHTML = addressRoute;
}
});
}
Как я могу улучшить свой код, чтобы получить более точные координаты, такие как ссылка выше?
есть какие-нибудь предложения? :)