2016-05-08 8 views

答えて

0

それは簡単なことです、あなたはあなたの緯度と経度を含むデータベーステーブルを作成する必要があります..あなたは単純な英語のアドレスを持っている必要がある場合住所がを格納した後、GoogleのジオロケーションAPIを使用するために、 は、場所のテーブル内のすべてのエントリのためには.cs

public StringBuilder locs = new StringBuilder(); //globalVariable 
    StringBuilder sb = new StringBuilder(); 
     foreach (Location l in loc) 
          { 
           longitude = l.Yaxis; //where Yaxis is a variable in class Location to store longitude 
           lattudei = l.Xaxis; //where Xaxis is a variable in class Location to store Latitutde 
           sb.Append(string.Format(
           "['{2}','{0}','{1}','../Img/Icons/Vehicles/icon_{2}.png'],", 
           lati, lon, imgurl); 
          } 
    locs.Append(sb.ToString()); 

.aspxの

<script> 
    var map; 
map = new google.maps.Map(document.getElementById('map'), { 
        zoom: 5, 
        minZoom: 4, 
        maxZoom: 8, 
        center: new google.maps.LatLng(30.03105543, -39.44091797), 

       }); 
    var locations = [<%=locs %> ]; 
    var markers=[]; 
    for (i = 0; i < locations.length; i++) { 

        var marker = new google.maps.Marker({ 
         position: new google.maps.LatLng(locations[i][1], locations[i][2]), 
         map: map, 
         icon: new google.maps.MarkerImage(locations[i][3] + "?" + new Date().getTime(), 
          null, null, null, new google.maps.Size(40,15)), 
         id: locations[i][0], 


         }); 
        markers.push(marker); 
    </script> 
で物事 を次のようにします
関連する問題