ParseGeoPoint
public struct ParseGeoPoint : Codable, Hashable
extension ParseGeoPoint: CustomDebugStringConvertible
extension ParseGeoPoint: CustomStringConvertible
ParseGeoPoint
is used to embed a latitude / longitude point as the value for a key in a ParseObject
.
It could be used to perform queries in a geospatial manner using ParseQuery.whereKey:nearGeoPoint:
.
Warning
warning:Currently, instances ofParseObject
may only have one key associated with a ParseGeoPoint
type.
-
Latitude of point in degrees. Valid range is from
-90.0
to90.0
.Declaration
Swift
public var latitude: Double
-
Longitude of point in degrees. Valid range is from
-180.0
to180.0
.Declaration
Swift
public var longitude: Double
-
Create a
ParseGeoPoint
instance. Latitude and longitude are set to0.0
.Declaration
Swift
public init()
-
Create a new
ParseGeoPoint
instance with the specified latitude and longitude.Throws
An error of typeParseError
.Declaration
Swift
public init(latitude: Double, longitude: Double) throws
Parameters
latitude
Latitude of point in degrees.
longitude
Longitude of point in degrees.
-
Get distance in radians from this point to specified point.
Declaration
Swift
public func distanceInRadians(_ point: ParseGeoPoint) -> Double
Parameters
point
ParseGeoPoint
that represents the location of other point.Return Value
Distance in radians between the receiver and
point
. -
Get distance in miles from this point to specified point.
Declaration
Swift
public func distanceInMiles(_ point: ParseGeoPoint) -> Double
Parameters
point
ParseGeoPoint
that represents the location of other point.Return Value
Distance in miles between the receiver and
point
. -
Get distance in kilometers from this point to specified point.
Declaration
Swift
public func distanceInKilometers(_ point: ParseGeoPoint) -> Double
Parameters
point
ParseGeoPoint
that represents the location of other point.Return Value
Distance in kilometers between the receiver and
point
. -
Declaration
Swift
public init(from decoder: Decoder) throws
-
Declaration
Swift
public func encode(to encoder: Encoder) throws
-
Declaration
Swift
public var debugDescription: String { get }
-
Declaration
Swift
public var description: String { get }
-
Creates a new
ParseGeoPoint
instance for the givenCLLocation
, set to the location’s coordinates.Throws
An error ofParseError
type.Declaration
Swift
init(location: CLLocation) throws
Parameters
location
Instance of
CLLocation
, with set latitude and longitude. -
Creates a new
ParseGeoPoint
instance for the givenCLLocationCoordinate2D
, set to the location’s coordinates.Throws
An error ofParseError
type.Declaration
Swift
init(coordinate: CLLocationCoordinate2D) throws
Parameters
location
Instance of
CLLocationCoordinate2D
, with set latitude and longitude. -
Creates a new
CLLocation
instance for the givenParseGeoPoint
, set to the location’s coordinates.Declaration
Swift
func toCLLocation() -> CLLocation
Parameters
geopoint
Instance of
ParseGeoPoint
, with set latitude and longitude.Return Value
Returns a
CLLocation
. -
Creates a new
CLLocationCoordinate2D
instance for the givenParseGeoPoint
, set to the location’s coordinates.Declaration
Swift
func toCLLocationCoordinate2D() -> CLLocationCoordinate2D
Parameters
geopoint
Instance of
ParseGeoPoint
, with set latitude and longitude.Return Value
Returns a
CLLocationCoordinate2D
.