中心坐标与半径转换为ne和sw坐标

时间:2014-08-04 11:05:20

标签: ios cllocationdistance cllocationcoordinate2d

我有CLLocationCoordinate2D和半径(以米为单位)。 我想获得该区域的两个边界坐标(右上角和左下角)。

1 个答案:

答案 0 :(得分:3)

如果我理解你正确,你想要找到这两个红色方块:

enter image description here

感谢您找到here的代码,实现非常简单:

    CLLocationCoordinate2D cc0 = coordinate;
    CLLocationCoordinate2D cc1 = [self coordinateFromCoord:cc0 atDistanceKm:circleRadius atBearingDegrees:45];
    CLLocationCoordinate2D cc2 = [self coordinateFromCoord:cc0 atDistanceKm:circleRadius atBearingDegrees:225];
    NSLog(@"%.5f,%.5f -> %.5f,%.5f AND %.5f, %.5f", cc0.latitude, cc0.longitude, cc1.latitude, cc1.longitude, cc2.latitude, cc2.longitude);