2013-08-06 29 views
2

我不擅長數學,所以請幫助我。我有米的距離,我需要計算縮放級別和中心來映射。我怎樣才能做到這一點?我開始用這個,但現在我完全地失去了:Windows Phone - 從距離獲取縮放水平

var sCoord = new GeoCoordinate(startPoint.X, startPoint.Y); 
var eCoord = new GeoCoordinate(latitude, longitude); 
var distance = sCoord.GetDistanceTo(eCoord); 

感謝

+0

只要距離間隔映射到實現目標縮放級別 –

回答

0

如果我沒有低估你,你可以通過下面的代碼

var start = ...; 
var finish = ...; 

// Calculate center 
var center = new GeoCoordinate((start.Latitude + finish.Latitude)/2, 
    (start.Longitude + finish.Longitude)/2); 
var width = Math.Abs(start.Longitude - finish.Longitude); 
var height = Math.Abs(start.Latitude - finish.Latitude); 

Map.SetView(new LocationRectangle(center, width, height));