こんにちは、私は xml データから情報を取得し、Google マップにマーカーを出力する関数を持っています。私の問題は、あるポイントから別のポイントへのパスを作成したいということです。これはデータを取得するコードです
`
$.ajax({
type:"POST",
url:"PipeServlet?op=1",
dataType:"xml",
success: function(xml){
// Parses the data from xml
var newLat, newLon, newDesc,newName;
$(xml).find("deal").each(function(){
newName = $(this).find("name").text();
newLat = $(this).find("lat").text();
newLon = $(this).find("lon").text();
newDesc = $(this).find("desc").text();
// Displaying the Coupons on the map
marker = new google.maps.Marker({
position: new google.maps.LatLng(newLat,newLon),
map: map,
title: newName,
html: newDesc,
animation: google.maps.Animation.DROP
});`
だから私はリストに取得した日付を追加し、このコードのように線を引きたい:
mapLine = new google.maps.Polyline({map : map,
strokeColor : '#ff0000',
strokeOpacity : 0.6,
strokeWeight : 4,
path:[new google.maps.LatLng(33.240547551860935,35.6153623373566),new google.maps.LatLng(33.240009149357576,35.61381738496402)]
});`
path:[new google.maps.LatLng(33.240547551860935,35.6153623373566),new google.maps.LatLng(33.240009149357576,35.61381738496402)]
あなたの助けに感謝して、ライン が動的に作成されることを望みます