Constructor
new LatLonEllipsoidal_Datum(lat, lon, heightopt, datum)
Creates a geodetic latitude/longitude point on an ellipsoidal model earth using given datum.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
lat |
number | Latitude (in degrees). | ||
lon |
number | Longitude (in degrees). | ||
height |
number |
<optional> |
0 | Height above ellipsoid in metres. |
datum |
LatLon.datums | Datum this point is defined within. |
- Source:
Example
import LatLon from '/js/geodesy/latlon-ellipsoidal-datum.js';
const p = new LatLon(53.3444, -6.2577, 17, LatLon.datums.Irl1975);
Extends
- LatLonEllipsoidal
Members
(static) datums
Datums; with associated ellipsoid, and Helmert transform parameters to convert from WGS-84
into given datum.
Note that precision of various datums will vary, and WGS-84 (original) is not defined to be
accurate to better than ±1 metre. No transformation should be assumed to be accurate to
better than a metre, for many datums somewhat less.
This is a small sample of commoner datums from a large set of historical datums. I will add
new datums on request.
- Source:
Example
const a = LatLon.datums.OSGB36.ellipsoid.a; // 6377563.396
const tx = LatLon.datums.OSGB36.transform; // [ tx, ty, tz, s, rx, ry, rz ]
const availableDatums = Object.keys(LatLon.datums).join(', '); // ED50, Irl1975, NAD27, ...
(static) ellipsoids
Ellipsoids with their parameters; semi-major axis (a), semi-minor axis (b), and flattening (f).
Flattening f = (a−b)/a; at least one of these parameters is derived from defining constants.
- Source:
Example
const a = LatLon.ellipsoids.Airy1830.a; // 6377563.396
datum
Datum this point is defined within.
- Source:
Methods
(static) parse(lat|latlon, lonopt, heightopt, datumopt) → {LatLon}
Parses a latitude/longitude point from a variety of formats.
Latitude & longitude (in degrees) can be supplied as two separate parameters, as a single
comma-separated lat/lon string, or as a single object with { lat, lon } or GeoJSON properties.
The latitude/longitude values may be numeric or strings; they may be signed decimal or
deg-min-sec (hexagesimal) suffixed by compass direction (NSEW); a variety of separators are
accepted. Examples -3.62, '3 37 12W', '3°37′12″W'.
Thousands/decimal separators must be comma/dot; use Dms.fromLocale to convert locale-specific
thousands/decimal separators.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
lat|latlon |
number | string | Object | Geodetic Latitude (in degrees) or comma-separated lat/lon or lat/lon object. | ||
lon |
number |
<optional> |
Longitude in degrees. | |
height |
number |
<optional> |
0 | Height above ellipsoid in metres. |
datum |
LatLon.datums |
<optional> |
WGS84 | Datum this point is defined within. |
- Source:
Throws:
-
Unrecognised datum.
- Type
- TypeError
Returns:
Latitude/longitude point on ellipsoidal model earth using given datum.
- Type
- LatLon
Example
const p = LatLon.parse('51.47736, 0.0000', 0, LatLon.datums.OSGB36);
convertDatum(toDatum) → {LatLon}
Converts ‘this’ lat/lon coordinate to new coordinate system.
Parameters:
Name | Type | Description |
---|---|---|
toDatum |
LatLon.datums | Datum this coordinate is to be converted to. |
- Source:
Throws:
-
Unrecognised datum.
- Type
- TypeError
Returns:
This point converted to new datum.
- Type
- LatLon
Example
const pWGS84 = new LatLon(51.47788, -0.00147, 0, LatLon.datums.WGS84);
const pOSGB = pWGS84.convertDatum(LatLon.datums.OSGB36); // 51.4773°N, 000.0001°E
toCartesian() → {Cartesian}
Converts ‘this’ point from (geodetic) latitude/longitude coordinates to (geocentric) cartesian
(x/y/z) coordinates, based on the same datum.
Shadow of LatLonEllipsoidal.toCartesian(), returning Cartesian augmented with
LatLonEllipsoidal_Datum methods/properties.
- Source:
Returns:
Cartesian point equivalent to lat/lon point, with x, y, z in metres from
earth centre, augmented with reference frame conversion methods and properties.
- Type
- Cartesian