MLGeoPoint Class Reference

Inherits from NSObject
Conforms to NSCopying
NSSecureCoding
Declared in MLGeoPoint.h

Overview

Object which may be used to embed a latitude / longitude point as the value for a key in a MLObject. MLObjects with a MLGeoPoint field may be queried in a geospatial manner using MLQuery’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 MLGeoPoint

+ geoPoint

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

+ (MLGeoPoint *)geoPoint

Return Value

Returns a new MLGeoPoint.

Declared In

MLGeoPoint.h

+ geoPointWithLocation:

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

+ (MLGeoPoint *)geoPointWithLocation:(nullable CLLocation *)location

Parameters

location

CLLocation object, with set latitude and longitude.

Return Value

Returns a new MLGeoPoint at specified location.

Declared In

MLGeoPoint.h

+ geoPointWithLatitude:longitude:

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

+ (MLGeoPoint *)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.

Declared In

MLGeoPoint.h

+ geoPointForCurrentLocationInBackground:

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

+ (void)geoPointForCurrentLocationInBackground:(nullable void ( ^ ) ( MLGeoPoint *__nullable geoPoint , NSError *__nullable error ))geoPointHandler

Parameters

geoPointHandler

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

Declared In

MLGeoPoint.h

Controlling Position

  latitude

Latitude of point in degrees. Valid range [-90.0, 90.0].

@property (nonatomic) double latitude

Declared In

MLGeoPoint.h

  longitude

Longitude of point in degrees. Valid range [-180.0, 180.0].

@property (nonatomic) double longitude

Declared In

MLGeoPoint.h

Calculating Distance

– distanceInRadiansTo:

Get distance in radians from this point to specified point.

- (double)distanceInRadiansTo:(nullable MLGeoPoint *)point

Parameters

point

MLGeoPoint location of other point.

Return Value

distance in radians

Declared In

MLGeoPoint.h

– distanceInMilesTo:

Get distance in miles from this point to specified point.

- (double)distanceInMilesTo:(nullable MLGeoPoint *)point

Parameters

point

MLGeoPoint location of other point.

Return Value

distance in miles

Declared In

MLGeoPoint.h

– distanceInKilometersTo:

Get distance in kilometers from this point to specified point.

- (double)distanceInKilometersTo:(nullable MLGeoPoint *)point

Parameters

point

MLGeoPoint location of other point.

Return Value

distance in kilometers

Declared In

MLGeoPoint.h