Google maps saving draggable directions

后端 未结 2 1621
花落未央
花落未央 2020-11-29 04:59

You can create markers in my web application and create a route with google directions with those markers. But I want the user to be able to change the route aswell and i\'

2条回答
  •  眼角桃花
    2020-11-29 05:42

    This might be something that changed between sdleihssirhc's answer and now, but I tried the above solution and it kept failing on displayer.directions.route[0] saying it was undefined.

    It looks like the attribute was changed to routes which took me a while to figure out. Using the line below works for me:

    var waypoints = displayer.directions.routes[0].legs[0].via_waypoint;
    

    Hopefully that will save some time and frustration for anyone trying to get this to work.

提交回复
热议问题