2012-04-10 2 views
0

Find() 함수에서 거리 주소를 전달하여 Bing Maps를 구현하려고합니다. 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로되지 않는가?

답변

0

대신 map.LoadMap(null,

map.LoadMap(map.GetCenter() 또는

map.LoadMap(new VELatLong(45,90) 또는이

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

를 사용하려고