【问题标题】:Windows Phone - get zoom level from distanceWindows Phone - 从远处获取缩放级别
【发布时间】:2013-08-06 16:17:01
【问题描述】:
我不擅长数学,所以请帮帮我。我有以米为单位的距离,我需要计算缩放级别和中心以从中映射。我怎样才能做到这一点?我从这个开始,但现在我完全迷失了:
var sCoord = new GeoCoordinate(startPoint.X, startPoint.Y);
var eCoord = new GeoCoordinate(latitude, longitude);
var distance = sCoord.GetDistanceTo(eCoord);
谢谢
【问题讨论】:
标签:
c#
windows-phone-7
map
geocoding
【解决方案1】:
如果我没记错的话,您可以使用以下代码实现目标
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));