显示不同颜色的最佳路线 [英] Display Optimal Route In Different Colors
本文介绍了显示不同颜色的最佳路线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在地图上以不同颜色显示路线?
How to show the route on a map in different colors?
推荐答案
您必须使用 directionsRenderer 对象。
在您的api中尝试使用此代码
You have to use the directionsRenderer object.
Try with this code in your api
directionsDisplayActual = new google.maps.DirectionsRenderer({suppressMarkers: true, polylineOptions: polylineOptionsActual})
var polylineOptionsActual = {
strokeColor: '#FF0000',
strokeOpacity: 1.0,
strokeWeight: 10
};
如需更多参考,请参阅: -
https://developers.google.com/maps/documentation/java script / examples / directions-waypoints [ ^ ]
https://developers.google .com / maps / documentation / javascript / examples / directions-simple [ ^ ]
这篇关于显示不同颜色的最佳路线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文