Closed barayuda closed 8 years ago
I have the same problem.
In order to use lat and lng you have to create two objetc like coordOrigin={lat:latOrigin, lng:lngOrigin} and coordDestination={lat:latDestination, lng:lngDestination} and pass it to getdistance:
getdistance:{ options:{ origins:coordOrigin, destinations: coordDestination travelMode: google.maps.TravelMode.DRIVING }
@elros88 Thanks for response, Can I set distance with "km" or "miles"?
Thank for great jQuery plugins, I would like to get distance of 2 location with their LatLong, This is the code:
getdistance:{ options:{ origins:[-8.742621,115.167532], destinations:[lincor_map,bjrcor_map], // villa position travelMode: google.maps.TravelMode.DRIVING }, callback: function(results, status){ var html = ""; if (results){ for (var i = 0; i < results.rows.length; i++){ var elements = results.rows[i].elements; for(var j=0; j<elements.length; j++){ switch(elements[j].status){ case "OK": html += "From Airport: " + elements[j].distance.text + " (" + elements[j].duration.text + " by Driving)
"; break; case "NOT_FOUND": html += "Distance not found"; break; case "ZERO_RESULTS": html += "Distance NULL"; break; } console.log(elements[j].status); } } } else { html = "error"; } $("#villaDistance").html( html ); } }
But, in my console.log appear "NOT_FOUND". Is possible to use LatLong in origins and destinations ?
Thank you for your attentions :)