如何根据提供的地址在 ASP.NET 网站中动态显示 Bing 地图。我没有地址的纬度和经度,所以我必须直接传递地址并显示地图。
问问题
1377 次
1 回答
0
在 ASP.Net 标记页面中,我有一个包含地址的隐藏字段。基于此地址,使用下面提到的脚本加载 bing 地图。地址上放置了一个图钉,以便于识别地址。
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 回答