Plotting more than 8 waypoints in Google Maps v3

前端 未结 3 1312
我在风中等你
我在风中等你 2020-12-05 20:51

Migrating code from Javascript API 2 to 3. I have a list of locations which i need to plot in the form of a driving directions. This was done in v2 using the following code<

3条回答
  •  执笔经年
    2020-12-05 21:26

    Use Should need to Use array concept like these...

    directionsService[i].route({                                    
                        'origin': start,
                        'destination': end
                        'waypoints': waypts,
                        'travelMode': 'DRIVING'
                           },
                        function (directions, status){              
                                    if (status == google.maps.DirectionsStatus.OK) {
                                        directionsDisplay[j].setDirections(directions);
                                    }
                                });
    

    in these directionservice and directiondisplay are should be in array logic and using looping concepts use should need to assign start,end and waypoints dynamically and
    try sending multiple request means u ll get the route for n number of latlon's ...but the markers ll be repeat with same name after 8 waypoints for that we remove the default markers by using supressmarkers false property...

提交回复
热议问题