我正在使用此:http://hpneo.github.com/gmaps/examples.html
我有两个输入,我放了一个地址,我想跟踪两点之间的路线。我可以添加两个标记,但我不知道如何绘制路径。
关于如何做到这一点的任何想法?
谢谢!
这是我的代码......
GMaps.geocode({
address: address_from,
callback: function(results, status) {
if (status == 'OK') {
var address_from = results[0].geometry.location;
map.addMarker({
lat: address_from.lat(),
lng: address_from.lng()
});
}
}
});
GMaps.geocode({
address: address_to,
callback: function(results, status) {
if (status == 'OK') {
var address_to = results[0].geometry.location;
map.addMarker({
lat: address_to.lat(),
lng: address_to.lng()
});
}
}
});
map.drawRoute({
origin: [address_from.lat(), address_from.lng()],
destination: [address_to.lat(), address_to.lng()],
travelMode: 'driving',
strokeColor: '#131540',
strokeOpacity: 0.6,
strokeWeight: 6
});