我有一个功能,我可以通过点击地图将坐标输入。
我想通过在地图上单击两次来获取地图上两点的两个坐标以获取它们之间的方向。
我怎样才能做到这一点?
var pointa;
var pointb;
google.maps.event.addListener(map,'click',function(event){
var point=new google.maps.LatLng(event.latLng.lat(),event.latLng.lng());
document.path.lat1.value=event.latLng.lat();
document.path.lon1.value=event.latLng.lng();
pointa=new google.maps.Marker({
map: map,
position: point,
icon:'http://google.com/mapfiles/kml/paddle/A.png ',
draggable:true
});
});