asp.net - Path colouring in google maps -


i wanted know if possible change colors of path displayed in google maps apiv3 specially in transit section different using modes bus, rail , walking used displaying result.

can change displayed color of these different modes? black walking , sky blue other modes.

my code is:

function calcroutem()  {     var start = document.getelementbyid('dropdownlist1').value;     var end = document.getelementbyid('dropdownlist2').value;     var request = {         origin: start,         destination: end,         provideroutealternatives: true,         unitsystem: google.maps.unitsystem.metric,         travelmode: google.maps.directionstravelmode.transit,         transitoptions: {               departuretime: new date(1362799800000)         }     };     directionsservice.route(request, function(response, status) {     if (status == google.maps.directionsstatus.ok) {          directionsdisplay.setdirections(response);     }   }); } 

you can change colors of polylines if don't use directionsrenderer display them , render them yourself.

the directionsrendereroptions {suppresspolylines: false}

suppresspolylines | boolean | suppress rendering of polylines.

then process through results object creating polylines desired colors.

example of custom rendering route (you need polyline)

another option might (not tested) post process returned route, sending different colored pieces different directionsrenderer calls different values (colors) polylineoptions option.


Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -