2
您好,我有一個Javascript代碼,使用地址作爲地址顯示地圖。 該不會忽略從陣列讀出,陣列結構是這樣的:Javascript谷歌地圖,以緯度和經度座標顯示標註
var locations = ["1915 Edgewater Drive,Orlando,FL", "5555 Kirkman Rd.,Orlando,FL", "4965 Oak Ridge Road,Orlando,FL", "3011 E Colonial Dr,Orlando,FL", "300 Park Avenue,Winter Park,FL"];
用於顯示地圖與銷的代碼如下:
function initialize() {
//Planned direction display
directionsDisplay = new google.maps.DirectionsRenderer({
polylineOptions : {
strokeColor : 'brown',
strokeOpacity : 0.7,
strokeWeight : 3
},
suppressMarkers : true,
suppressPolylines : true
});
//actual direction display
directionsDisplayActual = new google.maps.DirectionsRenderer({
polylineOptions : {
strokeColor : 'brown',
strokeOpacity : 0.7,
strokeWeight : 3
},
suppressMarkers : true,
suppressPolylines : true
});
geocoder = new google.maps.Geocoder();
geocoder.geocode({ 'address': locations[0] }, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var chicago = new google.maps.LatLng(results[0].geometry.location.ob, results[0].geometry.location.pb);
var mapOptions = {
zoom: 6,
mapTypeId: google.maps.MapTypeId.ROADMAP,
center: chicago
}
map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
map_actual = new google.maps.Map(document.getElementById('map-actual'), mapOptions);
calcRoute();
}
});
}
現在代替使用位置與不會忽略我有一系列的經度和緯度座標這樣的:
var coordinates = [[28.378929,-80.6006008],[28.378628084853,-80.600730804958],[28.378956475407,-80.600553605881],[28.378929693408,-80.60055175679],[28.378785540514,-80.60065325285],[28.378935283517,-80.600646565422],[28.378950753943,-80.600504807166]]
所以,我怎樣才能改變我的代碼使用這些座標,而不是位置不會忽略?
謝謝。
對不起,我新的谷歌地圖我想改變實際的代碼,我怎麼沒看到在我的代碼中使用你的。 – OussamaLord
你可以顯示你使用'var locations'的地方嗎? – pascal