Rectangle 27 14

Good news and bad news :)

The bad news is that the Japanese address will come up for many remote locations, as this is an on-going issue in the Geocoding API. This has been reported in the Google Maps API issue tracker: https://code.google.com/p/gmaps-api-issues/issues/detail?id=9683

The good news is that you still get the correct distances and route from Distance Matrix API and Directions API.

Sign up for our newsletter and get our top new questions delivered to your inbox (see an example).

Google Maps Distance Matrix wrong result - Stack Overflow

google-maps google-distancematrix-api
Rectangle 27 11

The problem with this Japan location is its bounds which say it is all around the world:

"formatted_address" : "1 Chome-11 Kamifukubara, Yonago-shi, Tottori-ken 683-0004, Japan",
     "geometry" : {
        "bounds" : {
           "northeast" : {
              "lat" : 90,
              "lng" : 180
           },
           "southwest" : {
              "lat" : -90,
              "lng" : -180
           }
        },
        "location" : {
           "lat" : 35.4426127,
           "lng" : 133.3638089
        },
        "location_type" : "APPROXIMATE",
        "viewport" : {
           "northeast" : {
              "lat" : 90,
              "lng" : 180
           },
           "southwest" : {
              "lat" : -90,
              "lng" : -180
           }
        }
     },
     "place_id" : "ChIJlwBC99P3VjUReuUmCg7qU_E",
     "types" : [ "sublocality_level_3", "sublocality", "political" ]

Google Maps Distance Matrix wrong result - Stack Overflow

google-maps google-distancematrix-api
Rectangle 27 3

You need to query the FusionTable for the locations in there and use those in the query to the DistanceMatrix. As you have less than 500 rows in the table I would probably use the google visualization library, but the new JSONP API should work as well.

The DistanceMatrix is limited to 25 destinations. Proof of concept for your table with 94 rows, much more than that would be problematic (run into query limits and the quota)

// query the table for the destinations
  var queryString ="SELECT 'geometry' FROM "+FT_TableID;
  var queryText = encodeURIComponent(queryString);
  var query = new google.visualization.Query('http://www.google.com/fusiontables/gvizdata?tq='  + queryText);
  //set the callback function
  query.send(createDestinations);
}

function createDestinations(response) {
  if (!response) {
    alert('no response');
    return;
  }
  if (response.isError()) {
    alert('Error in query: ' + response.getMessage() + ' ' + response.getDetailedMessage());
    return;
  } 
  FTresponse = response;
  //for more information on the response object, see the documentation
   //http://code.google.com/apis/visualization/documentation/reference.html#QueryResponse
  numRows = response.getDataTable().getNumberOfRows();
  numCols = response.getDataTable().getNumberOfColumns();
  var geoXml = new geoXML3.parser();
  var bounds = new google.maps.LatLngBounds();
  var request=0;
  destinations[0] = [];
  for (var i=0; ((i<numRows) && (i<25)); i++) {
    var kml = FTresponse.getDataTable().getValue(i,0);
    geoXml.parseKmlString("<Placemark>"+kml+"</Placemark>");
    destinations[request].push(geoXml.docs[i].markers[0].getPosition());
    bounds.extend(geoXml.docs[i].markers[0].getPosition());
  }
  map.fitBounds(bounds);
  calculateDistances(0);
}

function calculateDistances(request) {
   service.getDistanceMatrix({
        origins: [origin],
        destinations: destinations[request],
        travelMode: google.maps.TravelMode.DRIVING,
        unitSystem: google.maps.UnitSystem.IMPERIAL,
        avoidHighways: false,
        avoidTolls: false
      }, function (response, status) {
    if (status != google.maps.DistanceMatrixStatus.OK) {
      alert('Error was: ' + status);
    } else {
      var origins = response.originAddresses;
      var destinationAdds = response.destinationAddresses;
      htmlString = '<table border="1">';
      deleteOverlays();
      for (var i = 0; i < origins.length; i++) {
        var results = response.rows[i].elements;
        for (var j = 0; j < results.length; j++) {
          htmlString += '<tr><td>'+destinationAdds[j]+'</td><td>' + results[j].distance.text +'</td></tr>';
        }
      }
    }
    var outputDiv = document.getElementById('outputDiv');
    htmlString += '</table>';
    outputDiv.innerHTML = htmlString;
  });
}

javascript - Google maps Distance Matrix and Fusion Tables - Stack Ove...

javascript google-maps matrix distance google-fusion-tables
Rectangle 27 2

I don't have a workaround other than what you suggested, using the Distance Matrix API web service (remember that the API should be invoked from the server side, so you should wrap it in your own service). It seems like language should be a parameter, so I created a public issue tracker which you can find here:

json - Google Maps Distance Matrix Language specification for Google M...

javascript json api google-maps
Rectangle 27 3

provides travel distance and time for a matrix of origins and destinations, based on the recommended route between start and end points

You need to query it through HTTP and you will get a JSON or XML response so you can use it in your VB.NET, C# or whatever language you want if you write and perform the HTTP request and manage the XML or JSON result.

You can pass several optional parameters to refine your query (for example, mode will let you specify the mode of transport, with driving as default).

There are also Client Libraries for Google Maps Web Services that you can use to query the service (currently Java, Python, Go and Node.js).

Okay, I did think it seemed like the proper choice. Thanks for confirming this.

javascript - Google Maps distance server-side - Stack Overflow

javascript c# vb.net google-maps
Rectangle 27 3

provides travel distance and time for a matrix of origins and destinations, based on the recommended route between start and end points

You need to query it through HTTP and you will get a JSON or XML response so you can use it in your VB.NET, C# or whatever language you want if you write and perform the HTTP request and manage the XML or JSON result.

You can pass several optional parameters to refine your query (for example, mode will let you specify the mode of transport, with driving as default).

There are also Client Libraries for Google Maps Web Services that you can use to query the service (currently Java, Python, Go and Node.js).

Okay, I did think it seemed like the proper choice. Thanks for confirming this.

javascript - Google Maps distance server-side - Stack Overflow

javascript c# vb.net google-maps
Rectangle 27 2

The distance matrix allows multiple results in a single query. You can do origins=my_origin_coordinate|my_destination_coordinate&destinations=my_origin_coordinate|my_destination_coordinate in a single request, which will give you both results. That won't really help with your quota though as the quota is based on "elements", and whether you do it in one query or two, it will be the same number of "elements".

Oh, I just realized that your solution takes 4 "elements" from my Google API quota/limitation (because I get a 2x2 matrix). If I use two separate single query (as I wrote in my question) then it takes only 1+1 "elements"...

Google maps distance matrix API: get absolute distance - Stack Overflo...

google-maps google-distancematrix-api
Rectangle 27 4

Only a single travel mode is supported per request. To get results for multiple travel modes, make multiple requests.

The documentation implies that but doesn't state it explicitly:

mode (defaults to driving) Specifies the mode of transport to use when calculating distance. Valid values and other request details are specified in the Travel Modes section of this document.

For the calculation of distances, you may specify the transportation mode to use. By default, distances are calculated for driving directions. The following travel modes are supported:

Note: Both walking and bicycling directions may sometimes not include clear pedestrian or bicycling paths, so these directions will return warnings in the returned result which you must display to the user.

Can I pass multiple travel modes when using The Google Maps Distance M...

google-maps-api-3 google-distancematrix-api
Rectangle 27 3

They are returned in the same order they are sent.

That isn't specifically stated, but the way I read the documentation it is implied.

var service = new google.maps.DistanceMatrixService();
var places = [{
  address: "New York, NY",
  lat: 40.7143528,
  lng: -74.0059731
}, {
  address: "Tampa, FL",
  lat: 27.950575,
  lng: -82.4571776
}, {
  address: "Newark, NJ",
  lat: 40.735657,
  lng: -74.1723667
}, {
  address: "Boston, MA",
  lat: 42.3584308,
  lng: -71.0597732
}, {
  address: "Baltimore, MD",
  lat: 39.2903848,
  lng: -76.6121893
}];
var foundlatlng = new google.maps.LatLng(40.65, -73.95); // Brooklyn, NY
var gotoLoc = [];
for (var i = 0; i < places.length; i++) {
  gotoLoc.push(new google.maps.LatLng(places[i].lat, places[i].lng));
}
var service = new google.maps.DistanceMatrixService(); //request distance matrix
var outputdiv = document.getElementById('info');

//     var goto = new google.maps.LatLng(places[i].lat, places[i].lng);
function callback(response, status) {
    var distancefield = distancefield;
    if (status == google.maps.DistanceMatrixStatus.OK) {
      var origins = response.originAddresses;
      var destinations = response.destinationAddresses;
      var htmlString = "<table border='1'>";
      var bounds = new google.maps.LatLngBounds();
      for (var c = 0; c < response.rows.length; c++) {
        var results = response.rows[c].elements;
        for (var r = 0; r < results.length; r++) {
          var element = results[r];
          var distancetext = element.distance.text;
          var durationtext = element.duration.text;
          var to = destinations[r];
          htmlString += "<tr><td>" + (r + 1) + "</td><td>" + places[r].address + "</td><td>" + response.originAddresses[c] + "</td><td>" + to + "</td><td>" + distancetext + "</td><td>" + durationtext + "</td></tr>";
          var marker = new google.maps.Marker({
            icon: 'http://gmaps-samples.googlecode.com/svn/trunk/markers/blue/marker' + (r + 1) + '.png',
            position: {
              lat: places[r].lat,
              lng: places[r].lng
            },
            map: map
          });
          bounds.extend(marker.getPosition());
        } //end for r
      } // end for c
      map.fitBounds(bounds);
      htmlString += "</table>";
      document.getElementById('info').innerHTML = htmlString;


    } //end if status=ok
  } //end callback

//    console.log(places);

var map;
var geocoder = new google.maps.Geocoder();

function initialize() {
  var mapOptions = {
    zoom: 8,
    center: foundlatlng,
    mapTypeId: google.maps.MapTypeId.ROADMAP
  };
  map = new google.maps.Map(document.getElementById('map_canvas'),
    mapOptions);

  service.getDistanceMatrix({
    origins: ["San Diego, CA", foundlatlng],
    destinations: gotoLoc,
    travelMode: google.maps.TravelMode.WALKING,
    unitSystem: google.maps.UnitSystem.IMPERIAL,
    avoidHighways: false,
    avoidTolls: false,
  }, callback); //end service.getdistancematrix()


}
google.maps.event.addDomListener(window, 'load', initialize);
html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%
}
#map_canvas {
  height: 400px;
  width: 100%;
}
tr,
td,
tbody,
table {
  height: 100%;
  width: 100%;
}
}
<script src="https://maps.googleapis.com/maps/api/js"></script>
<table border="1">
  <tr>
    <td>
      <div id="map_canvas"></div>
    </td>
  </tr>
  <tr>
    <td>
      <div id="info"></div>
    </td>
  </tr>
</table>

Thanks for the test, my tests show the same thing.

There is a big problem with this answer: ZERO_RESULTS are sent to the end of the list, mixing the results.

I don't see ZERO_RESULTS anywhere in the posted examples. Could you clarify the "big problem"? How do you get it to return ZERO_RESULTS?

javascript - How do I match destinations in the google maps Distance M...

javascript google-maps-api-3
Rectangle 27 1

Another option is to use the Bing Maps Routing service. It's a bit more work but depending on your use case the free terms of use for Bing Maps are much higher.

The routing service in Bing Maps allows up to 25 waypoints to be passed in a single response. If you need distances from A to B, C, D you could calculate a route from A-B-A-C-A-D. The response would return a route leg for each two locations. The odd indexed route legs would be your distance from A to the other locations. This would allow you to merge up to 12 locations into a single request. This would make things much faster and also reduce the number of requests that would need to be made. You can find documentation on the routing service and tips on using it in .NET here:

Does Google Maps have an option like this? Or must I request multiple times to get A-B-A-C-A-D behavior?

Google Maps Distance Matrix API versus others - Stack Overflow

google-maps distance bing-maps
Rectangle 27 1

The link you provided gives you two options for the API output, JSON and XML. Neither of those is JSONp. In order to use JSONp, the API must allow and support it.

If you want to use the API, you'll need to proxy the call via CORS or JSONp yourself. The following answer will likely help you:Loading cross domain endpoint with jQuery AJAX

javascript - AngularJS $http.jsonp() method to access Google Maps Dist...

javascript angularjs google-maps
Rectangle 27 2

private static final String API_KEY = "YOUR_API_KEY";
private static final GeoApiContext context = new GeoApiContext().setApiKey(API_KEY);


public DistanceMatrix estimateRouteTime(DateTime time, Boolean isForCalculateArrivalTime, DirectionsApi.RouteRestriction routeRestriction, LatLng departure, LatLng... arrivals) {
    try {
        DistanceMatrixApiRequest req = DistanceMatrixApi.newRequest(context);
        if (isForCalculateArrivalTime) {
            req.departureTime(time);
        } else {
            req.arrivalTime(time);
        }
        if (routeRestriction == null) {
            routeRestriction = DirectionsApi.RouteRestriction.TOLLS;
        }
        DistanceMatrix trix = req.origins(departure)
                .destinations(arrivals)
                .mode(TravelMode.DRIVING)
                .avoid(routeRestriction)
                .language("fr-FR")
                .await();
        return trix;

    } catch (ApiException e) {
        System.out.println(e.getMessage());
    } catch (Exception e) {
        System.out.println(e.getMessage());
    }
    return null;
}

The DistanceMatrix response object is like that :

{
   "destination_addresses" : [ "San Francisco, Californie, tats-Unis" ],
   "origin_addresses" : [ "Seattle, Washington, tats-Unis" ],
   "rows" : [
      {
         "elements" : [
            {
               "distance" : {
                  "text" : "1 300 km",
                  "value" : 1299878
               },
               "duration" : {
                  "text" : "12 heures 32 minutes",
                  "value" : 45146
               },
               "status" : "OK"
            }
         ]
      }
   ],
   "status" : "OK"
}

How to use Google Maps Distance Matrix JAVA API to obtain closest dist...

java google-maps google-distancematrix-api
Rectangle 27 1

Wouldn't it be so much more helpful if you could provide an Index/ID with each Origin and Destination that would be returned in the API response?

If the order is guaranteed to be the exact same as sent, I agree that this should work fine. But this is not stated as guaranteed and it seems to arbitrarily limit Google's ability to order the results in a way that suits them better.

Don't understand the downvotes, as this suggestion is very valuable: if the request object could be supplied with a 'correlation identifier', and if the response object would repeat/include that identifier... it would not be necessary to depend on undocumented / unspecified behavior (that currently is working as you'd expect, but the implementation could change without breaking the API).

Also, ZERO_RESULTS are sent to the end of the list. So if you have any Lat/Lng that can not be computed by Google then the "same order" solution does not work anymore.

javascript - How do I match destinations in the google maps Distance M...

javascript google-maps-api-3
Rectangle 27 17

What you want is the Distance Matrix API. That is, if you are really using it in combination google maps. Note that Google prohibits the use of this API if you are not using it with a Google Map somewhere on the page.

Here's a basic example of the Distance Matrix API:

<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
var origin = new google.maps.LatLng(55.930385, -3.118425),
    destination = "Stockholm, Sweden",
    service = new google.maps.DistanceMatrixService();

service.getDistanceMatrix(
    {
        origins: [origin],
        destinations: [destination],
        travelMode: google.maps.TravelMode.DRIVING,
        avoidHighways: false,
        avoidTolls: false
    }, 
    callback
);

function callback(response, status) {
    var orig = document.getElementById("orig"),
        dest = document.getElementById("dest"),
        dist = document.getElementById("dist");

    if(status=="OK") {
        orig.value = response.destinationAddresses[0];
        dest.value = response.originAddresses[0];
        dist.value = response.rows[0].elements[0].distance.text;
    } else {
        alert("Error: " + status);
    }
}
</script>
</head>
<body>
    <br>
    Basic example for using the Distance Matrix.<br><br>
    Origin: <input id="orig" type="text" style="width:35em"><br><br>
    Destination: <input id="dest" type="text" style="width:35em"><br><br>
    Distance: <input id="dist" type="text" style="width:35em">
</body>
</html>

This is a version of google's example adapted to your personal taste which I found in the Google Maps Api v3 - Distance Matrix section

This works if you make the following update: origins: [origin], destinations: [destination],

@Michael, good eye, thanks for the correction. And for any interested parties, here's a fiddle with the corrections while I'm at it.

How can I pass multiple destinations?

javascript - How to calculate distance between two cities using google...

javascript google-maps distance
Rectangle 27 1

It's just a typo, here is the correct line:

let response = await fetch(finalApiURL);

Not ApiURL, this one has no parameters and is therefore invalid, exactly as the doc says ;)

Hahaha :D I feel just a little dump. Thanks bud !

javascript - Get travel time between two addresses using The Google Ma...

javascript google-maps reactjs google-maps-api-3 react-native
Rectangle 27 1

Each query sent to the Google Maps Distance Matrix API is limited by the number of allowed elements, where the number of origins times the number of destinations defines the number of elements.

The Google Maps Distance Matrix API has the following limits in place:

Standard Usage Limits Users of the standard API:

When you were submitting a matrix of dimensions 33 x 3 you only had 99 elements, which was within the limit for the free tier of service. But when you added one more destination (giving you a matrix with dimensions either of 34 x 3 or 33 x 4), you exceeded 100, hence the error.

Your options include opting for the premium service, which gives you up to 625 elements per query, or somehow cutting down on the size of your input matrices.

Google distance matrix API: Maximal number of arguments? - Stack Overf...

google-maps google-distancematrix-api
Rectangle 27 12

You can do this by using Google Distance Matrix API:

// $details = "http://maps.googleapis.com/maps/api/distancematrix/json?origins=Seattle&destinations=San+Francisco&mode=driving&sensor=false";

    //you can also pass latitude/longitude values in origins


   $details = "http://maps.googleapis.com/maps/api/distancematrix/json?origins=41.43206,-81.38992&destinations=San+Francisco&mode=driving&sensor=false";


    $json = file_get_contents($details);

    $details = json_decode($json, TRUE);

    echo "<pre>"; print_r($details); echo "</pre>";

php - Get driving distance between two points using Google Maps API - ...

php
Rectangle 27 12

You can do this by using Google Distance Matrix API:

// $details = "http://maps.googleapis.com/maps/api/distancematrix/json?origins=Seattle&destinations=San+Francisco&mode=driving&sensor=false";

    //you can also pass latitude/longitude values in origins


   $details = "http://maps.googleapis.com/maps/api/distancematrix/json?origins=41.43206,-81.38992&destinations=San+Francisco&mode=driving&sensor=false";


    $json = file_get_contents($details);

    $details = json_decode($json, TRUE);

    echo "<pre>"; print_r($details); echo "</pre>";

php - Get driving distance between two points using Google Maps API - ...

php
Rectangle 27 10

The usual solution is to use the google.maps.geometry.spherical library computeDistanceBetween(from:LatLng, to:LatLng, radius?:number) method to reduce the number to about 10, then use the distance matrix return the driving distance to those locations so the results can be sorted by driving distance (actual travel distance), and reduced to the closest 3 to 5 locations by actual travel distance within the request limits.

function codeAddress() {
    var address = document.getElementById('address').value;
    geocoder.geocode( { 'address': address}, function(results, status) {
      if (status == google.maps.GeocoderStatus.OK) {
        map.setCenter(results[0].geometry.location);
    if (customerMarker) customerMarker.setMap(null);
        customerMarker = new google.maps.Marker({
            map: map,
            position: results[0].geometry.location
        });
    closest = findClosestN(results[0].geometry.location,10);
        // get driving distance
        closest = closest.splice(0,3);
        calculateDistances(results[0].geometry.location, closest,3);
      } else {
        alert('Geocode was not successful for the following reason: ' + status);
      }
    });
  }

function findClosestN(pt,numberOfResults) {
   var closest = [];
   document.getElementById('info').innerHTML += "processing "+gmarkers.length+"<br>";
   for (var i=0; i<gmarkers.length;i++) {
     gmarkers[i].distance = google.maps.geometry.spherical.computeDistanceBetween(pt,gmarkers[i].getPosition());
     document.getElementById('info').innerHTML += "process "+i+":"+gmarkers[i].getPosition().toUrlValue(6)+":"+gmarkers[i].distance.toFixed(2)+"<br>";
     gmarkers[i].setMap(null);
     closest.push(gmarkers[i]);
   }
   closest.sort(sortByDist);
   return closest;
}

function sortByDist(a,b) {
   return (a.distance- b.distance)
}

function calculateDistances(pt,closest,numberOfResults) {
  var service = new google.maps.DistanceMatrixService();
  var request =    {
      origins: [pt],
      destinations: [],
      travelMode: google.maps.TravelMode.DRIVING,
      unitSystem: google.maps.UnitSystem.METRIC,
      avoidHighways: false,
      avoidTolls: false
    };
  for (var i=0; i<closest.length; i++) request.destinations.push(closest[i].getPosition());
  service.getDistanceMatrix(request, function (response, status) {
    if (status != google.maps.DistanceMatrixStatus.OK) {
      alert('Error was: ' + status);
    } else {
      var origins = response.originAddresses;
      var destinations = response.destinationAddresses;
      var outputDiv = document.getElementById('side_bar');
      outputDiv.innerHTML = '';

      var results = response.rows[0].elements;
      for (var i = 0; i < numberOfResults; i++) {
        closest[i].setMap(map);
        outputDiv.innerHTML += "<a href='javascript:google.maps.event.trigger(closest["+i+"],\"click\");'>"+closest[i].title + '</a><br>' + closest[i].address+"<br>"
            + results[i].distance.text + ' appoximately '
            + results[i].duration.text + '<br><hr>';
      }
    }
  });
}

@geocodezip How can I pull the lat and lng inside the calculateDistances method used in the linked post? I am getting an error when trying to split "pt" to separate the lat and lng values. The reason I want to do this is so I can push the coords back into the street view image api.

javascript - Google Maps API - Getting closest points to zipcode - Sta...

javascript google-maps google-maps-api-3 maps google-maps-markers
Rectangle 27 10

The usual solution is to use the google.maps.geometry.spherical library computeDistanceBetween(from:LatLng, to:LatLng, radius?:number) method to reduce the number to about 10, then use the distance matrix return the driving distance to those locations so the results can be sorted by driving distance (actual travel distance), and reduced to the closest 3 to 5 locations by actual travel distance within the request limits.

function codeAddress() {
    var address = document.getElementById('address').value;
    geocoder.geocode( { 'address': address}, function(results, status) {
      if (status == google.maps.GeocoderStatus.OK) {
        map.setCenter(results[0].geometry.location);
    if (customerMarker) customerMarker.setMap(null);
        customerMarker = new google.maps.Marker({
            map: map,
            position: results[0].geometry.location
        });
    closest = findClosestN(results[0].geometry.location,10);
        // get driving distance
        closest = closest.splice(0,3);
        calculateDistances(results[0].geometry.location, closest,3);
      } else {
        alert('Geocode was not successful for the following reason: ' + status);
      }
    });
  }

function findClosestN(pt,numberOfResults) {
   var closest = [];
   document.getElementById('info').innerHTML += "processing "+gmarkers.length+"<br>";
   for (var i=0; i<gmarkers.length;i++) {
     gmarkers[i].distance = google.maps.geometry.spherical.computeDistanceBetween(pt,gmarkers[i].getPosition());
     document.getElementById('info').innerHTML += "process "+i+":"+gmarkers[i].getPosition().toUrlValue(6)+":"+gmarkers[i].distance.toFixed(2)+"<br>";
     gmarkers[i].setMap(null);
     closest.push(gmarkers[i]);
   }
   closest.sort(sortByDist);
   return closest;
}

function sortByDist(a,b) {
   return (a.distance- b.distance)
}

function calculateDistances(pt,closest,numberOfResults) {
  var service = new google.maps.DistanceMatrixService();
  var request =    {
      origins: [pt],
      destinations: [],
      travelMode: google.maps.TravelMode.DRIVING,
      unitSystem: google.maps.UnitSystem.METRIC,
      avoidHighways: false,
      avoidTolls: false
    };
  for (var i=0; i<closest.length; i++) request.destinations.push(closest[i].getPosition());
  service.getDistanceMatrix(request, function (response, status) {
    if (status != google.maps.DistanceMatrixStatus.OK) {
      alert('Error was: ' + status);
    } else {
      var origins = response.originAddresses;
      var destinations = response.destinationAddresses;
      var outputDiv = document.getElementById('side_bar');
      outputDiv.innerHTML = '';

      var results = response.rows[0].elements;
      for (var i = 0; i < numberOfResults; i++) {
        closest[i].setMap(map);
        outputDiv.innerHTML += "<a href='javascript:google.maps.event.trigger(closest["+i+"],\"click\");'>"+closest[i].title + '</a><br>' + closest[i].address+"<br>"
            + results[i].distance.text + ' appoximately '
            + results[i].duration.text + '<br><hr>';
      }
    }
  });
}

@geocodezip How can I pull the lat and lng inside the calculateDistances method used in the linked post? I am getting an error when trying to split "pt" to separate the lat and lng values. The reason I want to do this is so I can push the coords back into the street view image api.

javascript - Google Maps API - Getting closest points to zipcode - Sta...

javascript google-maps google-maps-api-3 maps google-maps-markers