AVGeoPoint Class Reference

Inherits from NSObject
Conforms to NSCopying
Declared in AVGeoPoint.h

Overview

Object which may be used to embed a latitude / longitude point as the value for a key in a AVObject. AVObjects with a AVGeoPoint field may be queried in a geospatial manner using AVQuery’s whereKey:nearGeoPoint:.

This is also used as a point specifier for whereKey:nearGeoPoint: queries.

Currently, object classes may only have one key associated with a GeoPoint type.

Creating a AVGeoPoint

+ geoPoint

Create a AVGeoPoint object. Latitude and longitude are set to 0.0.

+ (instancetype)geoPoint

Return Value

a new AVGeoPoint.

Discussion

Create a AVGeoPoint object. Latitude and longitude are set to 0.0.

Declared In

AVGeoPoint.h

+ geoPointWithLocation:

Creates a new AVGeoPoint object for the given CLLocation, set to the location’s coordinates.

+ (instancetype)geoPointWithLocation:(CLLocation *)location

Parameters

location

CLLocation object, with set latitude and longitude.

Return Value

a new AVGeoPoint at specified location.

Discussion

Creates a new AVGeoPoint object for the given CLLocation, set to the location’s coordinates.

Declared In

AVGeoPoint.h

+ geoPointWithLatitude:longitude:

Creates a new AVGeoPoint object with the specified latitude and longitude.

+ (instancetype)geoPointWithLatitude:(double)latitude longitude:(double)longitude

Parameters

latitude

Latitude of point in degrees.

longitude

Longitude of point in degrees.

Return Value

New point object with specified latitude and longitude.

Discussion

Creates a new AVGeoPoint object with the specified latitude and longitude.

Declared In

AVGeoPoint.h

+ geoPointForCurrentLocationInBackground:

Fetches the user’s current location and returns a new AVGeoPoint object via the provided block.

+ (void)geoPointForCurrentLocationInBackground:(void ( ^ ) ( AVGeoPoint *_Nullable geoPoint , NSError *_Nullable error ))geoPointHandler

Parameters

geoPointHandler

A block which takes the newly created AVGeoPoint as an argument.

Discussion

Fetches the user’s current location and returns a new AVGeoPoint object via the provided block.

Declared In

AVGeoPoint.h

Controlling Position

  latitude

Latitude of point in degrees. Valid range (-90.0, 90.0).

@property (nonatomic) double latitude

Discussion

Latitude of point in degrees. Valid range (-90.0, 90.0).

Declared In

AVGeoPoint.h

  longitude

Longitude of point in degrees. Valid range (-180.0, 180.0).

@property (nonatomic) double longitude

Discussion

Longitude of point in degrees. Valid range (-180.0, 180.0).

Declared In

AVGeoPoint.h

Calculating Distance

– distanceInRadiansTo:

Get distance in radians from this point to specified point.

- (double)distanceInRadiansTo:(AVGeoPoint *)point

Parameters

point

AVGeoPoint location of other point.

Return Value

distance in radians

Discussion

Get distance in radians from this point to specified point.

Declared In

AVGeoPoint.h

– distanceInMilesTo:

Get distance in miles from this point to specified point.

- (double)distanceInMilesTo:(AVGeoPoint *)point

Parameters

point

AVGeoPoint location of other point.

Return Value

distance in miles

Discussion

Get distance in miles from this point to specified point.

Declared In

AVGeoPoint.h

– distanceInKilometersTo:

Get distance in kilometers from this point to specified point.

- (double)distanceInKilometersTo:(AVGeoPoint *)point

Parameters

point

AVGeoPoint location of other point.

Return Value

distance in kilometers

Discussion

Get distance in kilometers from this point to specified point.

Declared In

AVGeoPoint.h