У меня следующие данные. 1.source имя. 2.определение имя. Мне нужно найти пары lat-long на пути от источника к пункту назначения. Там есть какой-нибудь доступный для Google Api? Я ответил на эти вопросы Finding intermediate Lattitude Longitude between two given points, но не могу понять все это. Может ли кто-нибудь попросить об этом проще?Поиск промежуточной широты и долготы в javascript
EDIT вот что я пытался
//store lat and long
var sd_array=[];
$('#processbtn').click(function(e){
//get source and destination name
var source=$('#source').val();
var destination=$('#destination').val();
if(source==''||destination==''){
alert("all fields required");
}else{
//decode lat-long from address
getLatitudeAndLongitude(source);
getLatitudeAndLongitude(destination);
}
});
function getLatitudeAndLongitude(address){
var geocoder = new google.maps.Geocoder();
geocoder.geocode({ 'address': address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var latitude = results[0].geometry.location.lat();
var longitude = results[0].geometry.location.lng();
//store to array
sd_array.push(latitude);
sd_array.push(longitude);
}
});
}
function getInterMediateLatLong(sd_array){
//get intermediate locations
/*sd_array[0] source lat
sd_array[1] source long
sd_array[2] destination lat
sd_array[3] destination long*/
}
мне нужна помощь, чтобы добиться получения промежуточных мест.
Сколько "промежуточные пункты" вам нужно, только один? Что вы не понимаете в [Руководстве] (https://developers.google.com/maps/documentation/directions/)? Это типичная проблема [XY plane] (https://en.wikipedia.org/wiki/Cartesian_coordinate_system), у вас есть точки A, B и требуется набор точек между ними. –
От 3 до 5 пар, также я новичок в API-интерфейсе google map –