2011-08-20 82 views
2

在我的Bing Maps V6.3實現中,我能夠使用以下代碼圍繞點數組圍繞我的地圖。中心Bing地圖V7圍繞點陣

map.SetMapView(latlonArray); 
if (map.GetZoomLevel() > 10) { 
    map.SetZoomLevel(10); 
}; 

此代碼在Bing Maps V7中不起作用,我無法在Web上找到替代方法。

注:latlonArray只是簡單地填充這樣

var increment = 0; 
$.each(json_object, function() { 
    latlonArray[increment] = new VELatLong(this.lat, this.lon); 
    increment = ++increment; 
}); 
+0

看到我對這個問題的回答:http://stackoverflow.com/questions/7107536/bing-virtual-earth-7-0-calculate-area/7110178#7110178 –

回答

3

您需要LocationRect.fromLocations()方法。它接受一組位置,並返回一個矩形。

另外:對於v7,表示緯度/經度位置的新類型是Microsoft.Maps.Location,而不是VELatLong。

+0

不錯。繪製結果時,我總是跟蹤最小/最大緯度/經度。取決於你有多少針腳,這可能會更快。 –