GeoPoint

AV. GeoPoint

Represents a latitude / longitude point that may be associated with a key in a AVObject or used as a reference point for geo queries. This allows proximity-based queries on the key.

Only one key in a class may contain a GeoPoint.

Example:

  var point = new AV.GeoPoint(30.0, -20.0);
  var object = new AV.Object("PlaceObject");
  object.set("location", point);
  object.save();

Constructor

new GeoPoint()

Source:
Creates a new GeoPoint with any of the following forms:
Example
new GeoPoint(otherGeoPoint)
new GeoPoint(30, 30)
new GeoPoint([30, 30])
new GeoPoint({latitude: 30, longitude: 30})
new GeoPoint()  // defaults to (0, 0)

Methods

(static) current() → {Promise.<AV.GeoPoint>}

Source:
Creates a GeoPoint with the user's current location, if available.
Returns:
Type
Promise.<AV.GeoPoint>

kilometersTo(point) → {Number}

Source:
Returns the distance from this GeoPoint to another in kilometers.
Parameters:
Name Type Description
point AV.GeoPoint the other AV.GeoPoint.
Returns:
Type
Number

milesTo(point) → {Number}

Source:
Returns the distance from this GeoPoint to another in miles.
Parameters:
Name Type Description
point AV.GeoPoint the other AV.GeoPoint.
Returns:
Type
Number

radiansTo(point) → {Number}

Source:
Returns the distance from this GeoPoint to another in radians.
Parameters:
Name Type Description
point AV.GeoPoint the other AV.GeoPoint.
Returns:
Type
Number

toJSON() → {Object}

Source:
Returns a JSON representation of the GeoPoint, suitable for AV.
Returns:
Type
Object