1

提供されたアドレスに基づいて、ASP.NETWebサイトでBingマップを動的に表示する方法。住所の緯度と経度がないので、住所を直接渡して地図を表示する必要があります。

4

1 に答える 1

0

ASP.Netマークアップページに、アドレスを含む非表示のフィールドがあります。このアドレスに基づいて、BingMapは以下のスクリプトを使用して読み込まれます。画鋲は、住所を簡単に識別できるように住所に配置されています。

var map = null;
var pinid = 0;

function GetMap() {

    map = new VEMap('theMap');
     map.LoadMap();
    map.SetZoomLevel(10);
    FindLoc(); 
}

function FindLoc() {
    try {
        map.Find("<b>Property Address:</b>",
                            document.getElementById('ctl00_head_HiddenField1').value,
                              null,
                              null,
                              1,
                              1,
                              true,
                              true,
                              true,
                              true,
                              ProcessResults);
    }
    catch (e) {
        alert(e.message);
    }
}

function ProcessResults(layer, results, places, hasmore)
{
  CreatePin("Default", places[0].LatLong);
}

function CreatePin(type, point)
{
  if (point != 'Unavailable')
  {
      var pin = new VEShape(VEShapeType.Pushpin, point);
      pin.SetTitle('<b>Property Address:</b>');      
      pin.SetDescription(document.getElementById('ctl00_head_HiddenField1').value);
      map.AddShape(pin);
  }
}
于 2010-10-27T12:54:11.117 に答える