CLLocation(AerisCore)
@interface CLLocation (AerisCore)
CLLocation (Aeris) extension
Adds capabilities to measure distance and direction from coordinates and other locations, define bounding boxes and more.
-
Returns the great-circle distance between two coordinates.
Declaration
Objective-C
+ (CLLocationDistance) awf_distanceFromCoordinate:(CLLocationCoordinate2D)fromCoord toCoordinate:(CLLocationCoordinate2D)toCoord;
Swift
class func awf_distance(from fromCoord: CLLocationCoordinate2D, to toCoord: CLLocationCoordinate2D) -> CLLocationDistance
Parameters
fromCoord
The starting coordinate from which to measure the distance
toCoord
The coordinate to which the distance is measured
Return Value
The distance between the two coordiantes as
CLLocationDistance
-
Returns the distance between the location and another coordinate.
Declaration
Objective-C
- (CLLocationDirection)awf_distanceFromCoordinate: (CLLocationCoordinate2D)fromCoord;
Swift
func awf_distance(from fromCoord: CLLocationCoordinate2D) -> CLLocationDirection
Parameters
fromCoord
The coordinate to which the distance is measured.
Return Value
The distance between the location and the coordinate.
-
Returns a direction (in degrees) between an origin coordinate and a destination coordinate.
Declaration
Objective-C
+ (CLLocationDirection) awf_directionFromCoordinate:(CLLocationCoordinate2D)fromCoord toCoordinate:(CLLocationCoordinate2D)toCoord;
Swift
class func awf_direction(from fromCoord: CLLocationCoordinate2D, to toCoord: CLLocationCoordinate2D) -> CLLocationDirection
Parameters
fromCoord
The origin coordinate
toCoord
The destination coordinate
Return Value
The direction to the destination coordinate in degrees
-
Returns a direction (in degrees) between the receiver and the given location.
Declaration
Objective-C
- (CLLocationDirection)awf_directionToLocation:(CLLocation *)location;
Swift
func awf_direction(to location: CLLocation!) -> CLLocationDirection
Parameters
location
The destination location
Return Value
The direction to the destination location in degrees
-
Returns the coordinate bounding box which contains all of the locations.
Declaration
Objective-C
+ (AWFCoordinateRect)awf_boundingBoxContainingLocations:(NSArray *)locations;
Swift
class func awf_boundingBoxContainingLocations(_ locations: [Any]!) -> AWFCoordinateRect
Parameters
locations
The array of
CLLocation
instances to be included in the bounding boxReturn Value
The bounding box as
AWFCoordinateRect
-
Returns the bounding box of a circle defined by a center coordinate and radius in meters.
Declaration
Objective-C
+ (AWFCoordinateRect)awf_boundingBoxWithCenter: (CLLocationCoordinate2D)centerCoord radius:(CLLocationDistance)radius;
Swift
class func awf_boundingBox(withCenter centerCoord: CLLocationCoordinate2D, radius: CLLocationDistance) -> AWFCoordinateRect
Parameters
centerCoord
The center coordinate of the circle
radius
The radius of the circle in meters
Return Value
The bounding box containing the circle