我正在寻找一种将米转换为mapview区域的方法。
CLLocation
的{{1}}是一个双精度数,表示以米为单位的精确度。 horizontalAccuracy
会regionThatFits:
MKCoordinateRegion
span
和longitudeDelta
。如何将米转换为经度/纬度范围?
答案 0 :(得分: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;
}