2012-04-10 30 views
0

我試圖通過在Find()函數中傳遞街道地址來實現Bing地圖。 Zoom參數在LoadMap()函數中不起作用。這裏是我的代碼:Bing Maps LoadMap()函數縮放參數

var map; 

function GetMap() { 
    var street = "Street address"; 
    var city = "City"; 
    var state = "State"; 
    var address = ""; 
    var zoom = 10; 
    if (street != "") { 
     address += street; 
     zoom = 19; 
    } 
    if (city != "") { 
     if (address != "") 
      address += ", "; 
     address += city; 
    } 
    if (state != "") { 
     if (address != "") 
      address += ", "; 
     address += state; 
    } 

    map = new VEMap('bingMap'); 
    map.LoadMap(null, zoom, VEMapStyle.Hybrid, false, VEMapMode.Mode2D, true, 1); 
    map.Find(null, address, null, null, null, null, null, null, null, null, FindCallback); 
} 

function FindCallback(layer, resultsArray) { 
    var pin = new VEShape(VEShapeType.Pushpin, map.GetCenter()); 
    pin.SetCustomIcon("<img src='image url' width='30' />"); 
    map.AddShape(pin); 
} 

任何想法,爲什麼這不會放大到19?取而代之的 map.LoadMap(null,

回答

0

嘗試

map.LoadMap(map.GetCenter()map.LoadMap(new VELatLong(45,90)

或使用

map.SetCenterAndZoom((new VELatLong(lat, lng), zoom);