hpneo / gmaps

the easiest way to use Google Maps
https://hpneo.dev/gmaps/
7.03k stars 1.28k forks source link

Waypoints in map.travelRoute #339

Closed crystalgeek closed 9 years ago

crystalgeek commented 10 years ago

Hi I'm using the example route option and having trouble adding waypoints. Can you tell me where im going wrong?

$('#start_travel').click(function(e){ e.preventDefault(); map.travelRoute({ //LatLng origin: [51.53228, -0.10605], destination: [51.545611, -0.102782], travelMode: 'bicycling', waypoints: [51.540967, -0.105958],
step: function(e){ $('#instructions').append('

  • '+e.instructions+'
  • '); $('#instructions li:eq('+e.step_number+')').delay(450*e.step_number).fadeIn(200, function(){ map.setCenter(e.end_location.lat(), e.end_location.lng()); map.drawPolyline({ path: e.path, strokeColor: '#131540', strokeOpacity: 0.6, strokeWeight: 6 }); }); } }); }); });

    hpneo commented 10 years ago

    Hi, you need to set the waypoints this way: https://developers.google.com/maps/documentation/javascript/examples/directions-waypoints?hl=es