Giter VIP home page Giter VIP logo

Comments (6)

hpneo avatar hpneo commented on June 8, 2024

Hi, you can use the waypoints option (read more here: https://developers.google.com/maps/documentation/javascript/reference#DirectionsRequest and here: https://developers.google.com/maps/documentation/javascript/reference#DirectionsWaypoint)

from gmaps.

CThomas87 avatar CThomas87 commented on June 8, 2024

Thanks, are the any examples provided in the examples folder using them?

from gmaps.

hpneo avatar hpneo commented on June 8, 2024

Not yet, but the format would be:

map.getRoutes({
...,
  waypoints: [{
    location: new google.maps.LatLng(lat_number, lng_number),
    stopover: false
  },{
    location: new google.maps.LatLng(another_lat_number, another_lng_number),
    stopover: false
  }]
});

from gmaps.

CThomas87 avatar CThomas87 commented on June 8, 2024

I can't seem to get it to work at all, im trying to grab a list of 10 or so waypoints and display the route + directions like the routes advanced example

from gmaps.

hpneo avatar hpneo commented on June 8, 2024

Please post a fiddle (http://jsfiddle.net/) with your code.

from gmaps.

reinos avatar reinos commented on June 8, 2024

This is not working because the waypoints are not set in the code. Add this on rule nr 718

waypoints : options.waypoints

in:

 this.drawRoute = function(options) {
      var self = this;
      this.getRoutes({
        origin: options.origin,
        destination: options.destination,
        travelMode: options.travelMode,
    waypoints : options.waypoints,
        callback: function(e) {
          if (e.length > 0) {
            self.drawPolyline({
              path: e[e.length - 1].overview_path,
              strokeColor: options.strokeColor,
              strokeOpacity: options.strokeOpacity,
              strokeWeight: options.strokeWeight
            });
            if (options.callback) {
              options.callback(e[e.length - 1]);
            }
          }
        }
      });
    };

from gmaps.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.