0

I am building a waypoints Google map. I have the start and end points, which are in the same location. It seems to draw a map with my waypoints, but the start and end locations are not on my map. There is no A point. Someone else must have had to deal with this.

Any help? Here is my code. Standard code from Google samples:

function calcRoute() {
  depotNumber = document.getElementById("depot").value;
  var start = fullDepotAddress;   
  var end = fullDepotAddress;    
  var waypts = [];
  var checkboxArray = document.getElementById("stores");
  for (var i = 0; i < checkboxArray.length; i++) {
    if (checkboxArray.options[i].selected == true) {
      waypts.push({
      location:storeAddress[ checkboxArray[i].value],
      stopover:true});
    }
  }

var request = {
  origin: start, 
  destination: end,
  waypoints: waypts,
  optimizeWaypoints: true,
  travelMode: google.maps.DirectionsTravelMode.DRIVING
};

directionsService.route(request, function(response, status) {
  if (status == google.maps.DirectionsStatus.OK) {
    directionsDisplay.setDirections(response);
    var route = response.routes[0];
    var summaryPanel = document.getElementById("directions_panel");
    summaryPanel.innerHTML = "";
    // For each route, display summary information.
    for (var i = 0; i < route.legs.length; i++) {
      var routeSegment = i + 1;
      summaryPanel.innerHTML += "<b>Route Segment: " + routeSegment + "</b><br />";
      summaryPanel.innerHTML += route.legs[i].start_address + " to ";
      summaryPanel.innerHTML += route.legs[i].end_address + "<br />";
      summaryPanel.innerHTML += route.legs[i].distance.text + "<br /><br />";
    }
  }
});
}

Also, the waypoints don't seem to follow a traveling salesman algorithm. It has my route going all over. Are the routes supposed to come out optimized?

Thanks

Kara
  • 6,115
  • 16
  • 50
  • 57
Greg
  • 31
  • 7
  • Can't see your map. You sure the "A" point isn't hiding underneath the end point? – geocodezip Jun 28 '12 at 15:13
  • thank you, I zoomed all the way in. And Don't see the A point. But maybe it is exactly under my last point. Is there a way to layer up the A point above the last point? – Greg Jun 28 '12 at 16:02
  • If you were to provide a link to your map, or even just the start/end point and a waypoint or two, we might be able to do more than guess. If the start and end point are at the same coordinates, the markers will be directly on top of each other. You could try making them draggable so you can move the top one and see. – geocodezip Jun 28 '12 at 16:13
  • Thank you, We are on an internal network. Here are 2 pictures: http://uploadpad.com/files/zoommap.jpg http://uploadpad.com/files/fullmap.jpg I might just have to educate my users that the last letter is also the start. – Greg Jun 28 '12 at 17:36

1 Answers1

0

How about the start/end coordinates and some of the waypoints then?

Update: Here is your route with draggable directions. Notice that the "A" marker is under the "I" marker (drag the "I" marker off of the "A" marker to verify that).

geocodezip
  • 158,664
  • 13
  • 220
  • 245
  • Here is a crazy direction http://uploadpad.com/files/map2.jpg 3070 Market St, San Francisco, CA 94114, USA 1180-1198 Stanyan St, San Francisco, CA 94117, USA 2190 Geary Blvd, San Francisco, CA 94115, USA Trainor St, San Francisco, CA 94103, USA 3311 Market St, San Francisco, CA 94114, USA 48-60 Worth St, San Francisco, CA 94114, USA 122-142 Hartford St, San Francisco, CA 94114, USA 186 Alpine Terrace, San Francisco, CA 94117, USA It seems like A should go to E first. But D goes all the way to E. It might be the best route. It seems strange. – Greg Jun 28 '12 at 21:38