Rigth now on my app I generate a polyline in this way, I receive an array “route” with all markers that I get from database with that markers it´s possible to generate the polyline:
var routeArray = null;
function drawRoute(mapa, routeArray, varBool){
if(!routeArray){
var coordRoute = routeArray;
routeArray= new google.maps.Polyline({
map: map,
path: coordRoute,
geodesic: true,
strokeColor: "#FF0000",
strokeOpacity: 1.0,
strokeWeight: 3
});
}if(varBool){
routeArray.setMap(map);
}else{
routeArray.setMap(null);
}
}
I would like to generate the polyline, but instead this way in which you see straigth lines I would prefer Google Directions Service. Any suggestion?
Thanks in advance.
Have you checked the google direction api docs for usage info and examples? Have you tried anything? Please do so and if you have questions/issues post your new code and we can help further.