我正在寻找一种将米转换为地图视图区域的方法。
CLLocation'shorizontalAccuracy是双精度数,以米为单位表示精度。regionThatFits:需要MKCoordinateRegion一个spanwithlongitudeDelta和latitudeDelta。如何将米转换为经度/纬度跨度?
我正在寻找一种将米转换为地图视图区域的方法。
CLLocation'shorizontalAccuracy是双精度数,以米为单位表示精度。regionThatFits:需要MKCoordinateRegion一个spanwithlongitudeDelta和latitudeDelta。如何将米转换为经度/纬度跨度?
找到了答案。好像纬度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;
}