Constructor
new GeoPoint(latitudeopt, longitudeopt)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
latitude |
string | number | Object | Array.<number> |
<optional> |
A coordinate pair (latitude first), |
longitude |
number |
<optional> |
The GeoPoint's longitude |
- Source:
Members
(static) DEG_TO_RAD :number
How many radians fit in one degree.
Type:
- number
- Source:
(static) EARTH_RADIUS_IN_KILOMETERS :number
The Earth radius in kilometers used by GeoPoint#kilometersTo
Type:
- number
- Source:
(static) EARTH_RADIUS_IN_MILES :number
The Earth radius in miles used by GeoPoint#milesTo
Type:
- number
- Source:
latitude :number
Latitude of the given point
Type:
- number
- Source:
longitude :number
Longitude of the given point
Type:
- number
- Source:
Methods
(static) current() → {Promise.<GeoPoint>}
Creates a GeoPoint with the user's current location, if available.
- Source:
Returns:
A promise that will be resolved with a GeoPoint
- Type
- Promise.<GeoPoint>
kilometersTo(point) → {number}
Returns the distance from this GeoPoint to another in kilometers.
Parameters:
Name | Type | Description |
---|---|---|
point |
GeoPoint | another GeoPoint |
- Source:
- See:
Returns:
The distance in kilometers
- Type
- number
milesTo(point) → {number}
Returns the distance from this GeoPoint to another in miles.
Parameters:
Name | Type | Description |
---|---|---|
point |
GeoPoint | another GeoPoint |
- Source:
- See:
Returns:
The distance in miles
- Type
- number
radiansTo(point) → {number}
Computes the arc, in radian, between two WGS-84 positions.
The haversine formula implementation is taken from:
href="http://www.movable-type.co.uk/scripts/latlong.html">www.movable-type.co.uk/scripts/latlong.html}
Returns the distance from this GeoPoint to another in radians.
Parameters:
Name | Type | Description |
---|---|---|
point |
GeoPoint | another GeoPoint |
Returns:
the arc, in radian, between two WGS-84 positions
- Type
- number
toJSON() → {json}
Returns a JSON representation of the GeoPoint
- Source:
Returns:
A GeoJson object of this GeoPoint
- Type
- json
toString() → {string}
A String representation in latitude, longitude format
- Source:
Returns:
The string representation of this class
- Type
- string