How can I change the color of direction line in google map api I checked the gdriection,but there's nothing about color this is my code
function direction()
{
var txtAddress = document.getElementById("<%=txtAddress.ClientID %>");
var address = txtAddress.value;
var TextBox1 = document.getElementById("<%=TextBox1.ClientID %>");
var address1 = TextBox1.value;
directions = new GDirections(map, directionsPanel);
directions.load("from: " + address1 + " to: " + address + "");
// var address =txtAddress.value + " " + TextBox3.value;
}
Thank you
See this similar answer on the Maps Google group: https://groups.google.com/forum/?fromgroups#!topic/google-maps-api/-1yGOmMwd7I
Seems you can't change the colour after instantiating the GPolyLine
, so you need to build two GPolyLine
s and add/remove them from the overlay to display a different colour.
Without knowing any better, a way of doing it would be:
GDirections
constructor a GMap
, so it doesn't add any GPolyLine
s GLatLng
vertices from GDirections.getVertex(index)
GPolyLine
s with different colours GPolyLine
on the map with GMap2.addOverlay(GOverlay)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.