]> gitweb.michael.orlitzky.com - dead/census-tools.git/blobdiff - www/maps/maps/templates/javascript/routing.mako
Updated the provideTripAlternatives parameter to the newer provideRouteAlternatives.
[dead/census-tools.git] / www / maps / maps / templates / javascript / routing.mako
index ecab0247e9252e8b1af10409f41ef6e039dd3057..b3b1c919258830d7005268e231090175f121f3cd 100644 (file)
@@ -33,12 +33,12 @@ function routing_callback(result, status) {
   if (status == google.maps.DirectionsStatus.OK) {
     json_string += JSON.stringify(result);
 
-    for (var trip_idx = 0; trip_idx < result.trips.length; trip_idx++) {
-      num_routes = result.trips[trip_idx].routes.length;
-      if (num_routes > 1) {
-         alert("Unexpected number of routes (" +
-             result.trips.routes.length.toString() +
-             ") on trip number " + trip_idx.toString() + '.');
+    for (var route_idx = 0; route_idx < result.routes.length; route_idx++) {
+      var num_legs = result.routes[route_idx].legs.length;
+      if (num_legs > 1) {
+         alert("Unexpected number of legs (" +
+             result.routes.legs.length.toString() +
+             ") on route number " + route_idx.toString() + '.');
       }
     }
   }
@@ -97,18 +97,18 @@ function get_directions(pairs_to_skip) {
        producer_latlng = producers[i].name;
       }
       
-      if (consumers[i].latitude && consumers[i].longitude) {
-       consumer_latlng = new google.maps.LatLng(consumers[i].latitude,
-                                                consumers[i].longitude);
+      if (consumers[j].latitude && consumers[j].longitude) {
+       consumer_latlng = new google.maps.LatLng(consumers[j].latitude,
+                                                consumers[j].longitude);
       }
       else {
-       consumer_latlng = consumers[i].name;
+       consumer_latlng = consumers[j].name;
       }
       
       var directions_request = {
        origin: producer_latlng,
        destination: consumer_latlng,
-       provideTripAlternatives: true,    
+       provideRouteAlternatives: true,   
        travelMode: google.maps.DirectionsTravelMode.DRIVING
       }