Class: LatLonEllipsoidal_Vincenty

latlon-ellipsoidal-vincenty~LatLonEllipsoidal_Vincenty()

Extends LatLonEllipsoidal with methods for calculating distances and bearings between points, and destination points given distances and initial bearings, accurate to within 0.5mm distance, 0.000015″ bearing. By default, these calculations are made on a WGS-84 ellipsoid. For geodesic calculations on other ellipsoids, monkey-patch the LatLon point by setting the datum of ‘this’ point to make it appear as a LatLonEllipsoidal_Datum or LatLonEllipsoidal_ReferenceFrame point: e.g. import LatLon, { Dms } from '../latlon-ellipsoidal-vincenty.js'; import { datums } from '../latlon-ellipsoidal-datum.js'; const le = new LatLon(50.065716, -5.713824); // in OSGB-36 const jog = new LatLon(58.644399, -3.068521); // in OSGB-36 le.datum = datums.OSGB36; // source point determines ellipsoid to use const d = le.distanceTo(jog); // = 969982.014; 27.848m more than on WGS-84 ellipsoid

Constructor

new LatLonEllipsoidal_Vincenty()

Source:

Extends

  • LatLonEllipsoidal

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.
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
const p1 = new LatLon(-37.95103, 144.42487);
  const p2 = p1.destinationPoint(54972.271, 306.86816); // 37.6528°S, 143.9265°E

distanceTo(point) → {number}

Returns the distance between ‘this’ point and destination point along a geodesic on the surface of the ellipsoid, using Vincenty inverse solution.
Parameters:
Name Type Description
point LatLon Latitude/longitude of destination point.
Source:
Returns:
Distance in metres between points or NaN if failed to converge.
Type
number
Example
const p1 = new LatLon(50.06632, -5.71475);
  const p2 = new LatLon(58.64402, -3.07009);
  const 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. TODO: arg order? (this is consistent with destinationPoint, but perhaps less intuitive)
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
const p1 = new LatLon(-37.95103, 144.42487);
  const 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 given point, using Vincenty inverse solution.
Parameters:
Name Type Description
point LatLon Latitude/longitude of destination point.
Source:
Returns:
Final bearing in degrees from north (0°..360°) or NaN if failed to converge.
Type
number
Example
const p1 = new LatLon(50.06632, -5.71475);
  const p2 = new LatLon(58.64402, -3.07009);
  const 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 given point, using Vincenty inverse solution.
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
const p1 = new LatLon(50.06632, -5.71475);
  const p2 = new LatLon(58.64402, -3.07009);
  const b1 = p1.initialBearingTo(p2); // 9.1419°