1

我正在寻找一种将米转换为地图视图区域的方法。

CLLocation'shorizontalAccuracy是双精度数,以米为单位表示精度。regionThatFits:需要MKCoordinateRegion一个spanwithlongitudeDeltalatitudeDelta。如何将米转换为经度/纬度跨度?

4

1 回答 1

2

找到了答案。好像纬度1度等于111公里左右,也就是111120米

- (MKCoordinateRegion)regionForAccuracyOfLocation:(CLLocation *)location
{
    CLLocationDegrees spanInDegrees = (CLLocationDegrees) (location.horizontalAccuracy / 222240);

    MKCoordinateSpan span = MKCoordinateSpanMake(spanInDegrees, spanInDegrees) ;
    CLLocationCoordinate2D coordinate = location.coordinate;
    MKCoordinateRegion region = MKCoordinateRegionMake(coordinate, span);

    return region;
}
于 2011-05-02T08:43:33.453 回答