PFGeoPoint Class Reference
Inherits from | NSObject |
---|---|
Conforms to | NSCoding NSCopying |
Declared in | PFGeoPoint.h |
Overview
PFGeoPoint
may be used to embed a latitude / longitude point as the value for a key in a PFObject.
It could be used to perform queries in a geospatial manner using [PFQuery whereKey:nearGeoPoint:].
Currently, instances of PFObject may only have one key associated with a PFGeoPoint
type.
Creating a Geo Point
+ geoPoint
Create a PFGeoPoint object. Latitude and longitude are set to 0.0
.
+ (instancetype)geoPoint
Return Value
Returns a new PFGeoPoint
.
Declared In
PFGeoPoint.h
+ geoPointWithLocation:
Creates a new PFGeoPoint
object for the given CLLocation
, set to the location’s coordinates.
+ (instancetype)geoPointWithLocation:(nullable CLLocation *)location
Parameters
location |
Instace of |
---|
Return Value
Returns a new PFGeoPoint at specified location.
Declared In
PFGeoPoint.h
+ geoPointWithLatitude:longitude:
Create a new PFGeoPoint
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.
Declared In
PFGeoPoint.h
+ geoPointForCurrentLocationInBackground:
Fetches the current device location and executes a block with a new PFGeoPoint
object.
+ (void)geoPointForCurrentLocationInBackground:(nullable PFGeoPointResultBlock)resultBlock
Parameters
resultBlock |
A block which takes the newly created |
---|
Declared In
PFGeoPoint.h
Controlling Position
latitude
Latitude of point in degrees. Valid range is from -90.0
to 90.0
.
@property (nonatomic, assign) double latitude
Declared In
PFGeoPoint.h
longitude
Longitude of point in degrees. Valid range is from -180.0
to 180.0
.
@property (nonatomic, assign) double longitude
Declared In
PFGeoPoint.h
Calculating Distance
– distanceInRadiansTo:
Get distance in radians from this point to specified point.
- (double)distanceInRadiansTo:(nullable PFGeoPoint *)point
Parameters
point |
|
---|
Return Value
Distance in radians between the receiver and point
.
Declared In
PFGeoPoint.h
– distanceInMilesTo:
Get distance in miles from this point to specified point.
- (double)distanceInMilesTo:(nullable PFGeoPoint *)point
Parameters
point |
|
---|
Return Value
Distance in miles between the receiver and point
.
Declared In
PFGeoPoint.h
– distanceInKilometersTo:
Get distance in kilometers from this point to specified point.
- (double)distanceInKilometersTo:(nullable PFGeoPoint *)point
Parameters
point |
|
---|
Return Value
Distance in kilometers between the receiver and point
.
Declared In
PFGeoPoint.h