Center coordinate with radius convert to ne and sw coordinates

1.1k Views Asked by At

I have CLLocationCoordinate2D and some radius in meters. I would like to get two bounding coordinates (top-right and bottom-left) of the area.

1

There are 1 best solutions below

5
On BEST ANSWER

If I understand you correctly you want to location these 2 red squares:

enter image description here

Thanks to the code you that can find here the implementation is pretty simple:

    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);