必应地图加载映射() 函数缩放参数

Bing Maps LoadMap() function zoom parameter

本文关键字:函数 缩放 参数 映射 地图 加载      更新时间:2023-09-26

我正在尝试通过在 Find() 函数中传递街道地址来实现 Bing 地图。zoom 参数在 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,

尝试

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

或使用

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