directionsService.route (request,
function (result, status)
{
alert(status);
if (status == google.maps.DirectionsStatus.OK)
{
directionsDisplay.setDirections (result);
pointsArray = result.routes[0].overview_path;
The problem is that the *result.routes[0].overview_path;* returns an array of type ‘google.maps.LatLng’. i.e. Each element is an “object” of the class ‘google.maps.LatLng’, in that array.
I want to write all those returned latitudes and longitudes on a text file.
How to extract the individual “latitudes and longitudes” values from the object of the class “google.maps.LatLng“
http://code.google.com/apis/maps/documentation/javascript/reference.html#LatLng
The above link contains two methods:
lat()andlng()which do solve the issue.The code for the same is as follows: