Class: LatLon_Vincenty

latlon-vincenty~LatLon_Vincenty

Extends LatLon with methods for geodesics on the ellipsoid.

Constructor

new LatLon_Vincenty()

Source:

Extends

  • LatLon

Methods

destinationPoint(distance, initialBearing) → {LatLon}

Returns the destination point having travelled the given distance along a geodesic given by initial bearing from ‘this’ point, using Vincenty direct solution. Note: the datum used is of ‘this’ point; distance is on the surface of the ellipsoid (height is ignored).
Parameters:
Name Type Description
distance number Distance travelled along the geodesic in metres.
initialBearing number Initial bearing in degrees from north.
Source:
Returns:
Destination point.
Type
LatLon
Example
var p1 = new LatLon(-37.95103, 144.42487);
  var p2 = p1.destinationPoint(54972.271, 306.86816); // 37.6528°S, 143.9265°E

(private) direct(distance, initialBearing)

Vincenty direct calculation.
Parameters:
Name Type Description
distance number Distance along bearing in metres.
initialBearing number Initial bearing in degrees from north.
Source:
Throws:
If formula failed to converge.
Type
Error
Returns:
(Object} Object including point (destination point), finalBearing.

distanceTo(point)

Returns the distance between ‘this’ point and destination point along a geodesic, using Vincenty inverse solution. Note: the datum used is of ‘this’ point; distance is on the surface of the ellipsoid (height is ignored).
Parameters:
Name Type Description
point LatLon Latitude/longitude of destination point.
Source:
Returns:
(Number} Distance in metres between points or NaN if failed to converge.
Example
import LatLon from 'latlon-vincenty';
  var p1 = new LatLon(50.06632, -5.71475);
  var p2 = new LatLon(58.64402, -3.07009);
  var d = p1.distanceTo(p2); // 969,954.166 m

finalBearingOn(distance, initialBearing) → {number}

Returns the final bearing (reverse azimuth) having travelled along a geodesic given by initial bearing for a given distance from ‘this’ point, using Vincenty direct solution. Note: the datum used is of ‘this’ point; distance is on the surface of the ellipsoid (height is ignored).
Parameters:
Name Type Description
distance number Distance travelled along the geodesic in metres.
initialBearing LatLon Initial bearing in degrees from north.
Source:
Returns:
Final bearing in degrees from north (0°..360°).
Type
number
Example
var p1 = new LatLon(-37.95103, 144.42487);
  var b2 = p1.finalBearingOn(306.86816, 54972.271); // 307.1736°

finalBearingTo(point) → {number}

Returns the final bearing (reverse azimuth) having travelled along a geodesic from ‘this’ point to the specified point, using Vincenty inverse solution. Note: the datum used is of ‘this’ point.
Parameters:
Name Type Description
point LatLon Latitude/longitude of destination point.
Source:
Returns:
Initial bearing in degrees from north (0°..360°) or NaN if failed to converge.
Type
number
Example
var p1 = new LatLon(50.06632, -5.71475);
  var p2 = new LatLon(58.64402, -3.07009);
  var b2 = p1.finalBearingTo(p2); // 11.2972°

initialBearingTo(point) → {number}

Returns the initial bearing (forward azimuth) to travel along a geodesic from ‘this’ point to the specified point, using Vincenty inverse solution. Note: the datum used is of ‘this’ point.
Parameters:
Name Type Description
point LatLon Latitude/longitude of destination point.
Source:
Returns:
initial Bearing in degrees from north (0°..360°) or NaN if failed to converge.
Type
number
Example
var p1 = new LatLon(50.06632, -5.71475);
  var p2 = new LatLon(58.64402, -3.07009);
  var b1 = p1.initialBearingTo(p2); // 9.1419°

(private) inverse(point) → {Object}

Vincenty inverse calculation.
Parameters:
Name Type Description
point LatLon Latitude/longitude of destination point.
Source:
Throws:
If formula failed to converge.
Type
Error
Returns:
Object including distance, initialBearing, finalBearing.
Type
Object