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
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
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 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(54972.271, 306.86816); // 307.1736°
finalBearingOn(distance, initialBearing) → {number}
Returns the final bearing 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(54972.271, 306.86816); // 307.1736°
finalBearingTo(point) → {number}
Returns the final bearing 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°
finalBearingTo(point) → {number}
Returns the final bearing 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 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°
initialBearingTo(point) → {number}
Returns the initial bearing 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°
intermediatePointTo(point, fraction) → {LatLon}
Returns the point at given fraction between ‘this’ point and given point.
Parameters:
Name | Type | Description |
---|---|---|
point |
LatLon | Latitude/longitude of destination point. |
fraction |
number | Fraction between the two points (0 = this point, 1 = specified point). |
- Source:
Returns:
Intermediate point between this point and destination point.
- Type
- LatLon
Example
const p1 = new LatLon(50.06632, -5.71475);
const p2 = new LatLon(58.64402, -3.07009);
const pInt = p1.intermediatePointTo(p2, 0.5); // 54.3639°N, 004.5304°W
intermediatePointTo(point, fraction) → {LatLon}
Returns the point at given fraction between ‘this’ point and given point.
Parameters:
Name | Type | Description |
---|---|---|
point |
LatLon | Latitude/longitude of destination point. |
fraction |
number | Fraction between the two points (0 = this point, 1 = specified point). |
- Source:
Returns:
Intermediate point between this point and destination point.
- Type
- LatLon
Example
const p1 = new LatLon(50.06632, -5.71475);
const p2 = new LatLon(58.64402, -3.07009);
const pInt = p1.intermediatePointTo(p2, 0.5); // 54.3639°N, 004.5304°W